in reply to get keys using values in hash.
Do you mean "Given a value, how can I find the key?". If so the short answer is: "Probably you can't".
The longer answer is that keys are unique for any given hash but values are not. For example a hash may contain the following key => value pairs:
apple => red ball => red lemon => yellow lime => green grass => green
The keys are unique, but the values (colours) are not. You can not ask for the single green object because there is more than one.
If there were a one to one mapping (keys and values unique) then you could generate a second hash using the first hash's values as keys and the first hash's keys as values - you would then have a reverse lookup.
If however you are asking "How do I get a list of the keys", the answer is trivial: keys.
|
|---|