Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Hash issues

by roboticus (Chancellor)
on Jul 26, 2017 at 22:06 UTC ( [id://1196122]=note: print w/replies, xml ) Need Help??


in reply to Hash issues

Nicpetbio23!:

You don't reference a hash from the values, but from the keys. So $ret{$value1} isn't going to give you what you want. You really need something like $ret{$key1} to get value 1. So you probably want to create a reversed hash:

my %reversed_ret = (reverse %ret);

Then you can check for $reversed_ret{$value1}. Note: there's a problem with reversing a hash like this: If you have the same value1 for multiple keys, then that value will return only the last key you added to the reversed hash.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-25 13:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found