in reply to Print keys corresponding to duplicate values

You need to loop through your keys, and check if your values are the same. Usually one uses another hash %SEEN to store the reverse: value-to-key (instead of key-to-value) while looping over the keys...

ANOTHER idea is to loop over the values:

for my $val (values %hash){

And detect FIRST which ones you already seen (using %SEEN in a numerical fashion), before looping through the keys and knowing the value, look it up if you seen it already.

Also, write your hash definition like this:

use strict; use warnings; my %hash = ( 'a' => 1, 'b' => 2, 'c' => '1', 'd' => 3, 'e' => '5' );

keys