@a = qw( 2 two 1 one ); print join( " ", sort { $a cmp $b || $a <=> $b } @a ), "\n"; # 1 2 one two