in reply to Swapping keys and values in a hash with slices
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