in reply to How to check similarity of two hash tables

They're equal if, as you say, they have the same number of keys AND all the keys in one are in the other.
my $areEqual=1; if(keys %hash1 == keys %hash2) { foreach my $key(keys %hash1) { if(!exists $hash2{$key}) { $areEqual=0; last; } } } if($areEqual) { print "ARE "; } else { print "ARE NOT "; } print "equal\n";