Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Comparing elements in Array of Hashes (AoH)

by moritz (Cardinal)
on Jul 18, 2012 at 14:14 UTC ( #982438=note: print w/ replies, xml ) Need Help??


in reply to Comparing elements in Array of Hashes (AoH)

If the inner hashes always just have those 3 keys, there's no need for an inner loop:

my $same = 0; if (@AoH_curr == @AoH_prev) { $same = 1; for my $i (0..$#AoH_curr) } my $a = $AoH_curr[$i]; my $b = $AoH_prev[$i]; if ($a->{node} ne $b->{node} || $a->{link} ne $b->{link} || $a->{link} ne $b->{link}) { $same = 0; last; } } }

(Untested).


Comment on Re: Comparing elements in Array of Hashes (AoH)
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://982438]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2014-10-22 07:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (114 votes), past polls