use warnings; use strict; my @a = qw( 2 two 1 11 12 one 3abcd 6foo ); print join( " ", sort { $a <=> $b || $a cmp $b } @a ), "\n"; __END__ Argument "two" isn't numeric in numeric comparison (<=>) at c:\temp\sort.pl line 4. Argument "one" isn't numeric in numeric comparison (<=>) at c:\temp\sort.pl line 4. Argument "3abcd" isn't numeric in numeric comparison (<=>) at c:\temp\sort.pl line 4. Argument "6foo" isn't numeric in numeric comparison (<=>) at c:\temp\sort.pl line 4. one two 1 2 3abcd 6foo 11 12 #### #... print join( " ", sort { $a cmp $b || $a <=> $b } @a ), "\n"; __END__ 1 11 12 2 3abcd 6foo one two