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
In reply to Re^2: How best to compare hash values?
by doug
in thread How best to compare hash values?
by jimbass
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |