in reply to Re^3: Need to find unique values in hash
in thread Need to find unique values in hash

Thank you POJ. This really helped but i am still not able to figure out, how to print the duplicates? This way, only unique elements will be present in hash and i am successfully able to get the hash. Can you please help in providing how can i print which value/values are repeated for their respective keys?

Well, I need to print above according to this :

 ++$count2{$key}{$_} for @{$hash{$key}};

Replies are listed 'Best First'.
Re^5: Need to find unique values in hash
by poj (Abbot) on Feb 05, 2019 at 08:17 UTC

    Replace print Dumper \%count2 with this code.

    for my $key1 (sort keys %count2){ for my $key2 (sort keys %{$count2{$key1}}){ if ($count2{$key1}{$key2} > 1){ printf "%-10s %-10s %d\n",$key1,$key2,$count2{$key1}{$key2}; } } }
    poj