in reply to sorting by numbers then alphabetically

Untested, beware of typos:
$ref = [map {$$_[0]} sort {$$a[1] cmp $$b[1]} map {my $srn = $_->seq_region_name; [$_, sprintf "%03d;%s", ($srn =~ /[0-9]/ ? ($srn, "") : ( +0, $srn))]} @$ref];

Replies are listed 'Best First'.
Re^2: sorting by numbers then alphabetically
by Tux (Canon) on Dec 23, 2010 at 21:21 UTC

    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 ];

    Enjoy, Have FUN! H.Merijn