in reply to Re: Comaring contents of 2 Hash of Arrays
in thread Comaring contents of 2 Hash of Arrays

No, I think that s/he means that s/he wants to compare each of the values in the arrays pointed to (via array refs) by the corresponding keys in each hash. What I can't tell is if s/he expects the items to be in the same order in each hash or not.

If so, the most straight-forward way to do it would be something like:

my @Non_Matching_Keys; foreach $key (keys %HoL_compare_pub) { my @orig_a = @{$HoL_pub{$key)}; my @comp_a = @{%HoL_compare_pub{$key}}; foreach(0 .. @orig_a) { if($orig_a[$_] ne $comp_a[$_]) { push @Non_Matching_Keys, $key; } } }

Note that that is totaly untested. Also, if the order of the two arrays are different, it won't work. Maybe running a sort() on them both first would work?

Update: Nevermind... I think I got confused by the "Hash of Arrays" part (and I was in a hurry to leave work ;-)... Looks like Tuna just wanted to see if a router (hash element) existed in one hash and not the other, just like dfog and dkubb said. =)

bbfu
Seasons don't fear The Reaper.
Nor do the wind, the sun, and the rain.
We can be like they are.