in reply to Is there a way to switch a hash values <> keys with a slice?

You have received a few suggestion on how to 'invert' a hash. Note that these only work if no value is repeated in the original hash. A more general solution can be found in the very old book "Perl Cookbook". There probably is a module, but I did not find it with a quick search.

Note: Although it is not possible to sort your hash, it is possible to access it in a sorted order. See FAQ How do I sort a hash (optionally by value instead of key)?

Bill
  • Comment on Re: Is there a way to switch a hash values <> keys with a slice?