You need to dereference the array at $var{$key} in a similar way to the
way you did it when you created the array, so something like this should
work:

foreach my $key(keys %VAR){
   foreach my $element(@{$VAR{$key}}){
      #do something...
   }
}

-----Original Message-----
From: Sonika Sachdeva [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 21, 2006 4:53 PM
To: beginners@perl.org
Subject: Perl Hash of arrays : comparison

Hi,

I have Hash of array. I want to compare the array values within the
hash.
How can it be done?

if ($eline =~ /$pattern/ ) {
                $eline =~ /(.*)\"(\w+)\s(.*)\?(.*)\"/ ; my $uniq=$1; my
$url=$4;
                chomp($uniq);chomp($url);
                my @var= ( split("&",$url) );
                foreach my $k (@var) {
                        @value = split("=",$k);
                        if ( $value[0] eq "package_guid" ) { push
@{$VAR{$uniq}},@value; }
                        if ( $value[0] eq "deployment_id" ) { push
@{$VAR{$uniq}},@value; }
                        }
                foreach my $x (keys %VAR) {
                        foreach my $y (keys %VAR) {
                                < Comparison code if 2 entries have same
pacakge_guid >                        }
                }
        }


plz suggest.
Thanks,


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to