my @sorted = sort { sprintf("%010u%s",-$a,$a) cmp sprintf("%010u%s",-$b,$b) } @array;