You have too many missing elements in the code you submitted for me to guess
what you are trying to do ... for example @mref and @svref isnot defined
anywhere else in your code except when u r trying to print its contents.

i am not sure what the input to this script will be but i tried running it
with input Query=blablabla and Query=lalalal i do get the keys printed but
there is no values because of the ay the script login is the array perpetually
has nothing in it ...

On Thu, Aug 23, 2001 at 01:05:25PM -0400, Jennifer Pan shaped the electrons to read:
> Dear all, 
> 
> I would like to construct a hash, whose value holds a reference to an
> array of arrays,
> however all the keys in my hash have the exact same value, which turns
> out to be the value of the last element I put it!!
> 
> I felt that something is wrong in the data structure, that I should not
> keep re-using @match or @splice, they get overwritten, so I only came
> with the last one. But I am not sure how to fix it, or is there a way?
> 
> Any insight is much appreciated!!!
> 
> -Jennifer 
> 
> 
> #! /usr/bin/perl -w
> 
> my %hash;
> my $MatchLine;
> my $SVLine;
> 
> while (<STDIN>) {
>   chomp $_;
>   if (/^Query=(\w+)$/) {
> 
>     if ($key) {
>     
>     
>     @match = split (' ', $MatchLine);
>     @splice = split (' ', $SVLine);
>     
>     
>     
>     $ref = [\@match, \@splice];
>     
>     $hash{"$key"}= $ref;
>     $key = $1;
>     } else {
>   
>     $key =$1
>     }
>   } elsif (/^MA:(.+)$/) {
>     $MatchLine = $1;
>   } elsif (/^SV:(.+)$/) {
>     $SVLine = $1;
>   } else {
>   }
> }
> 
> 
> foreach $key (keys %hash) {
>       print "$key\n";
>       print "$_" for (@$mref);
>       print "\n";
>       print "$_" for (@$svref);
>       print "\n";
> }
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

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

Reply via email to