in reply to re-key a hash
Also, sort by default is a string comparison sort, so it goes like 1,10,11,12,13,14,15,16,17,18,19,2,20, etc, and negaitve values would come before the positive. Run this bit of code:
To do a numeric sort, you needforeach my $i (sort (-20 .. 20)) { print "$i\n"; }
In the end, i'd still agree with ovid about what you're doing!sort {$a <=> $b} (keys %hashone)
|
|---|