scalar grep { my ($a, $b) = ( $h1{$_}, $h2{$_} ); ( not defined $a and defined $b ) or ( not defined $b and defined $a ) or $a ne $b } @k1