http://www.perlmonks.org?node_id=157730


in reply to How to check similarity of two hash tables

Of course, the obligatory one-liner (ok, one-expression) version:
my $areEqual = (keys %hash1 == keys %hash2) && 0 == grep {!exists $hash2{$_}} keys %hash1;