$hash{-10} = 'bar'; $hash{-1} = 'foo'; $hash{12} = 'baz'; %hash = map { (keys %hash) - 1 => delete $hash{$_} } sort {$b <=> $a} keys %hash; print map {"$_ => $hash{$_}\n"} sort { $a <=> $b } keys %hash;
In reply to Re: re-key a hash ( Best (-: )
by ccn
in thread re-key a hash
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |