use List::Compare; for (List::Compare->new([keys %h1], [keys %h2])->get_Lonly) { print "$_ $h1{$_}\n"; }