for my $key ( keys %one_hash ) { next if ( exists( $other_hash{$key} )); # now do something with this $key, which exists only in %one_hash... } #### for my $key ( keys %doublet ) { if ( exists( $triplet{$key} )) { # need to check values next if ( $doublet{$key}[0] eq $triplet{$key}[2] and $doublet{$key}[1] eq $triplet{$key}[1] ); } # get here if $key does not exist in %triplet, # OR if $triplet{$key} is not equivalent to $doublet{$key} print "$key\n"; }