|laziness, impatience, and hubris|
How to compare hash values within the same hash?by phildeman (Acolyte)
|on Sep 24, 2013 at 22:24 UTC||Need Help??|
phildeman has asked for the
wisdom of the Perl Monks concerning the following question:
Is there a way to compare the values of one hash (while looping through the hash) and determine how many times
a value has occurred in the hash?
$hash = (
key1 => 10,
key2 => 10,
key3 => 3,
key4 => 5,
key5 => 10
In the hash, above, there are 3 occurrences of the value 10. I need to do this in order display the value
that has the highest frequency. Perhaps, there is a way to loop through the hash to compare the current
value to the previous value, then increment a counter variable by 1?