@x = qw( 5xxx 2xxx 300x 10xx ); @x = sort {$a =~/^d+/ <=> $b =~/^d+/} @x; # WRONG print "regex sort: @x\n";