|XP is just a number|
Re^2: inverting hash / grouping valuesby LanX (Abbot)
|on Sep 27, 2013 at 15:13 UTC||Need Help??|
> Have you looked at the safe_reverse function in Hash::MoreUtils?
Yes I looked - but I didn't install to try ... hmm thanks!
IMHO the documentation is quite misleading ...
Returns safely reversed hash (value, key pairs of original hash). If no BLOCK is given, following routine will be used:
(value,key pairs ???)
... and better examples showing in and output are lacking.
After looking at it I was unhappy about the blocked namespace, a module called Hash::MoreUtils could offer much more.
( addicted to the Perl Programming Language)
After diving into the code, it looks like safe_reverse will not represent unique values as 1-element-arrays but as scalars.
This partly explains my confusion, this function works like a normal reverse if all values are unique.
to be able to have the same effect like invert in the OP one needs to write