Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

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;

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

Comment on Re: Finding a hash key from the value (reverse lookup)
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2016-02-07 22:40 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (264 votes), past polls