On 2 February 2010 09:19, venu madhav <venutaurus...@gmail.com> wrote:

>        I've a situation where I create a hash variable in PERL and
> use it in Java script which is embedded in the CGI. The key for that
> hash is taken from JavaScript. For ex:
>
> ----- CGI code----
> my %hash{3}=300;
> ------JScript code---
> var var1 = 3;
> var variable = $hash{var1};
> ------------------------

At the creation of the CGI document, you can embed elements from the
Perl code in the site. In essence, what you may want to do is
print '<script type="text/javascript>';
print "var variable=$hash{3};";

which would interpolate into whatever value is there at the hash.
However, if the "var1" variable is changing at the client, you will
need to send the value back to the server if you want to get an answer
from the Perl hash.

In order for us to supply you with a better, more correct, answer, I
recommend you send us more information regarding both the nature of
your question, as well as the actual code that revolves around these
lines. (i.e. more context).

-- 
Erez

"The government forgets that George Orwell's 1984 was a warning, and
not a blueprint"
http://www.nonviolent-conflict.org/ -- http://www.whyweprotest.org/

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to