Home  |  Linux  | Mysql  | PHP  | XML
From:Peter Scott Date:Sun Feb  7 15:27:12 2010
Subject:Re: How to use a CGI/PERL hash variable in java script.
On Mon, 01 Feb 2010 23:19:27 -0800, venu madhav wrote:

> Hi All,
> 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};
> ------------------------
> When I run such a script, it is failing at the 3rd
> statement above. Can someone help me in resolving this?

No, your error is on the first line above. It has a syntax error and does
not compile.

Get your program running from the command line first and check the
JavaScript output by hand to see whether it wrote out what you thought
it should. Then put that output into a static page and check that your
browser loads and execute it correctly. You are not ready to take all
these steps at once.

--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
http://www.informit.com/store/product.aspx?isbn=0137001274
Navigate in group perl.beginners at sever nntp.perl.org
Previous Next


Your recent visits
Re: Perl script to monitor memory usage on unix box
RE: Substitution question
More compact way to write this
Re: sequential value check
Re: sequential value check



  
© No Copyright
You are free to use Anything, but please consult your advocate before doing so as this website
also list content from other sources which may be copyrighted.
Site Maintained by Zareef Ahmed
Powered By PHP Consultants