in reply to Re: sorting by numbers then alphabetically
in thread sorting by numbers then alphabetically
Using pack will speed this up enormously. Besides that he wanted the numbers before the strings, so default to 999 instead of 0):
$ref = [ map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { my $srn = lc $_->seq_region_name; [ $_, pack "sA*", $srn =~ /^[0-9]+$/ ? $srn : 999, $srn ] } @$ref ];
|
|---|