in reply to re-key a hash
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: re-key a hash
by BrowserUk (Patriarch) on Aug 02, 2004 at 23:43 UTC | |
by Aristotle (Chancellor) on Aug 03, 2004 at 02:35 UTC | |
|
Re^2: re-key a hash
by brool (Initiate) on Aug 03, 2004 at 01:05 UTC | |
by Aristotle (Chancellor) on Aug 03, 2004 at 02:17 UTC | |
|
Re^2: re-key a hash
by Roy Johnson (Monsignor) on Aug 03, 2004 at 01:46 UTC | |
by Aristotle (Chancellor) on Aug 03, 2004 at 02:19 UTC | |
|
Re^2: re-key a hash
by ysth (Canon) on Aug 02, 2004 at 23:37 UTC |