LenLindquist
IS-IT--Management
Hello,
I'm looking for an elegant solution to finding all of the keys in a hash that have the same value. I have a rather large hash of approximately 700,000 keys with values that may or may not unique to the key.
In other words, it is possible in my hash that the same value may be assigned to more than one key.
The end result I would like to have is a report showing all of the keys that share the same value. For this, I would like to sort the report by value and list all of the keys for each value.
Presently, the solution I have is to intermediately make a file of all of the matched values and then search through the entire hash for each of them to find the matching keys. Obviously this is time consuming and not the least bit "elegant!" I suspect my intermediate step is not even necessary.
Can anyone assist?
Thanks in advance!
Len Lindquist
I'm looking for an elegant solution to finding all of the keys in a hash that have the same value. I have a rather large hash of approximately 700,000 keys with values that may or may not unique to the key.
In other words, it is possible in my hash that the same value may be assigned to more than one key.
The end result I would like to have is a report showing all of the keys that share the same value. For this, I would like to sort the report by value and list all of the keys for each value.
Presently, the solution I have is to intermediately make a file of all of the matched values and then search through the entire hash for each of them to find the matching keys. Obviously this is time consuming and not the least bit "elegant!" I suspect my intermediate step is not even necessary.
Can anyone assist?
Thanks in advance!
Len Lindquist