use Sort::Key::Maker sort_num_str => sub { int($_), $_ }, qw(int str); #### salva@cabo:/tmp$ perl /tmp/skm.pl 100 Rate GRT sort S::K::M GRT 945/s -- -2% -26% sort 967/s 2% -- -25% S::K::M 1282/s 36% 33% -- salva@cabo:/tmp$ perl /tmp/skm.pl 1000 Rate sort GRT S::K::M sort 61.0/s -- -20% -40% GRT 75.8/s 24% -- -25% S::K::M 101/s 66% 34% -- salva@cabo:/tmp$ perl /tmp/skm.pl 100000 s/iter sort GRT S::K::M sort 3.38 -- -43% -49% GRT 1.92 76% -- -10% S::K::M 1.73 96% 11% --