in reply to Print keys corresponding to duplicate values
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' );
|
|---|