> -----Original Message-----
> From: Josiah Altschuler [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 08, 2002 11:05 AM
> To: '[EMAIL PROTECTED]'
> Subject: passing a hash using cgi.pm
> 
> 
> Hi.  I'm having trouble passing a hash from one program to 
> another through a
> link using cgi.pm.  My first program passes the hash like this (it's
> actually a hash that is one element of an array of hashes):
> 
> print pre a ( { -href =>
> "http://140.247.111.176/cgi-bin/redundancies.pl?request=%{$clu
> sArrayHash[1]}
> " }, "Redundant sequences");
> 
> 
> The code from my program that receives the hash looks like this:
> 
> %myHash = param("request");
> print header, start_html("Results"),
>       hr(),
>       h1("Results");
> for $key (keys %myHash)
> {
>       print ("$key, $myHash{$key}");
> }
> print end_html();
> 
> 
> And the web page ends up displaying data that looks like this:
> %{HASH(0x1bc2a60)}, 

Writing "%{$clusArrayHash[1]}" doesn't expand the hash inside
the double quotes. You would need to use something like:

   "@{[%{$clusArrayHash[1]}]}"

But even that won't work, because param() will just read that
in as a single string.

Something like this should work, letting CGI.pm do the work
for you:

   my $query = CGI->new({request => [%clusArrayHash[1]]})->query_string;

Now you can use $query after the ? in your href, and you can
read the param back in as a hash.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to