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.
In reply to Re: Hash issues
by roboticus
in thread Hash issues
by Nicpetbio23!
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |