my %hash1 = (a=>4,b=>5,c=>6,d=>7); my %hash2 = (a=>4,b=>5,c=>6,e=>7); # make a temp. copy of the keys of %hash1 my @h1k = keys %hash1; # delete from %hash1 all the keys in %hash2 delete @hash1{keys %hash2}; # hash1 only has keys left that are unique to it print "hash1 only: $_\n" for keys %hash1; # delete from %hash2 all the keys from %hash1 delete @hash2{@h1k}; # you're left with the keys that are only in %hash2 print "hash2 only: $_\n" for keys %hash2; __END__ hash1 only: d hash2 only: e