Here's my shot at doing it in a single step — but don't try this at home.
%hash = ( 0 .. keys( %hash ) - 1, @hash{ sort { $a <=> $b } keys %hash } )[ map +( $_, $_ + keys %hash ), 0 .. keys( %hash ) - 1 ];
Makeshifts last the longest.
In reply to Re: re-key a hash
by Aristotle
in thread re-key a hash
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |