Problems? Is your data what you think it is? | |
PerlMonks |
Re: Hash issuesby roboticus (Chancellor) |
on Jul 26, 2017 at 22:06 UTC ( [id://1196122]=note: print w/replies, xml ) | Need Help?? |
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:
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.
In Section
Seekers of Perl Wisdom
|
|