I need to find duplicate values in the perl hash, and then print the key / value pair and the associated duplicate counter, if that number is 1.
(I could leave a sample code for what I tried, but it would just lead to mass confusion and possibly uncontrollable laughter, and I really hope to do this through life with some semblance of self-esteem.)
The hash key / value will look like this:
%hash = qw('FHDJ-124H' => 'hostname1', 'HJDHUR-87878' => 'hostname2', 'HGHDJH-874673' => 'hostname1');
My desired result:
2 duplicates found for hostname1
FHDJ-124H
HGHDJH-874673
Using perl 5.6 on Solaris 10. A tightly controlled production environment where updating or downloading perl mods is not acceptable. (The change request for the transition to 5.8 is about 6 months).
Many thanks!
source
share