@h = sort {$a <=> $b} @arr = keys %hash; # doesn't sort @h = sort {$a <=> $b} 0 .. 3; # do sort @h = sort {$a <=> $b} @arr = 0 .. 3; # do sort