Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: highest value in hash (key is not value)

by Anonymous Monk
on Mar 31, 2013 at 02:27 UTC ( #1026318=note: print w/ replies, xml ) Need Help??


in reply to highest value in hash

You have   $highest=$key if ($highest <  $value) ;

You're storing the key, and comparing the key to the value

But it sounds like you want to compare values, not keys

So you need to store $highest_key and $highest_value, and compare $highest_value to $value


Comment on Re: highest value in hash (key is not value)
Download Code
Replies are listed 'Best First'.
Re^2: highest value in hash (key is not value)
by maciej (Initiate) on Mar 31, 2013 at 03:54 UTC
    Wow, I was trying to figure that out for the longest time and now that you pointed out what I was doing it's so obviouse. duh! Thanks everyone!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1026318]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2015-07-31 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (275 votes), past polls