in reply to A generic sorting problem

Well one idea might be this
sub smart_sort { my $obj=shift; my $array=UNIVERSAL::isa($obj,'HASH') ? [keys %$obj] : $obj; return [ $array->[0]=~/\D/ ? sort @$array : sort {$a <=> $b} @$arra +y ]; }
Other ideas are contained in (Golf) Keysort

By the way, you might want to have a look at Advanced Sorting - GRT - Guttman Rosler Transform as well as the ST by Merlyn and ST by Chromatic

HTH

Yves / DeMerphq
---
Writing a good benchmark isnt as easy as it might look.