my @sorted = map { $_->[0] } sort { $a->[1] <=> $b->[1] || $a->[2] cmp $b->[2] } map { my $s = $_->seq_region_name; [ $_, $s =~ m/^[0-9]+$/ ? $s : 999, $s ] } @unsorted;