my %hash = ( foo => ['this', 'that'], # Two different values bar => ['those', 'those'], # Two identical values baz => ['the', 'other'], # Not the same buzz => ['same', 'same'], # The same ); #### my %hash = ( foo => ['this', 'that'], # Two different values bar => ['those', 'those'], # Two identical values baz => ['the', 'other'], # Not the same buzz => ['same', 'same'], # The same ); while (my ($key, $aref) = each %hash) { if ($aref->[0] eq $aref->[1]) { print "$key\n"; } } #### if (2==@$aref && $aref->[0] eq $aref->[1]) ... #### while (my ($key, $aref) = each %hash) { my %seen; $seen{$_}++ for @$aref; next if 1 != keys %seen; print "$key\n"; }