in reply to Re^2: Is there a way to switch a hash values <> keys with a slice?
in thread Is there a way to switch a hash values <> keys with a slice?

you should also keep in mind that hash-keys are unique, any repeated value from the old hash will overwrite the last key-instance in your reversed hash.

(the only way to avoid information loss is a hash of arrays $h2{val}=[k1,k2,k3,...] but this requires more code.)

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

  • Comment on Re^3: Is there a way to switch a hash values <> keys with a slice?
  • Download Code