Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: How best to compare hash values?

by doug (Pilgrim)
on May 06, 2010 at 13:27 UTC ( [id://838698]=note: print w/replies, xml ) Need Help??


in reply to Re: How best to compare hash values?
in thread How best to compare hash values?

I generally do it this way too, but I check all keys that are in both. Something like:

my %union = ( %hash1, %hash2 ); my @keys = sort keys %union; undef %union; foreach my $key ( @keys ) { if ( ! exists $hash1{$key} ) { print "key $key is not in hash 1\n"; } elsif ( ! exists $hash2{$key} ) { print "key $key is not in hash 2\n"; } ....

- doug

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-19 14:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found