while (my ($key, $aref) = each %hash) { my %seen; $seen{$_}++ for @$aref; next if 1 != keys %seen; print "$key\n"; }