in reply to Re: 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?

thank you both! YEs makes sense I musta needed more coffee today!
  • Comment on Re^2: Is there a way to switch a hash values <> keys with a slice?

Replies are listed 'Best First'.
Re^3: Is there a way to switch a hash values <> keys with a slice?
by LanX (Saint) on Apr 19, 2022 at 16:16 UTC
    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