Do you know where your variables are? | |
PerlMonks |
Re: Swapping keys and values in a hash with slicesby tomhukins (Curate) |
on Oct 20, 2004 at 10:31 UTC ( [id://400808]=note: print w/replies, xml ) | Need Help?? |
This seems reasonable enough to me, with the usual caveat that you will lose information if multiple elements share the same value. I would never use this code in production, though. You mention other solutions using loops and map, but I find the %revhash = reverse %hash idiom more elegant.
In Section
Seekers of Perl Wisdom
|
|