Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Finding a hash key from the value (reverse lookup)

by davorg (Chancellor)
on Jan 22, 2001 at 19:03 UTC ( #53498=note: print w/replies, xml ) Need Help??


in reply to Finding a hash key from the value (reverse lookup)

The reverse method only works if your values are unique. If they are and you will be doing a lot of reverse lookups then it's worth building a reverse lookup hash. This is far simpler than it sounds:

my %rev_hash = reverse %hash;
--
<http://www.dave.org.uk>

"Perl makes the fun jobs fun
and the boring jobs bearable" - me

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://53498]
help
Chatterbox?
[beech]: thank you, it sure is pretty "code", yup, thats what I call it my ...
beech .oO( talking 'bout my ...)

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2017-02-28 08:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (398 votes). Check out past polls.