in reply to re-key a hash

You're losing some values because you're overwriting them before they get dealt with. The first key processed overwrites the value of $hash{0}. You could put the 'ordered' info into a different hash, and this wouldnt happen anymore.

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:

foreach my $i (sort (-20 .. 20)) { print "$i\n"; }
To do a numeric sort, you need
sort {$a <=> $b} (keys %hashone)
In the end, i'd still agree with ovid about what you're doing!