in reply to sorting numbered words

Others have given able comments on how to do this sort. May I take a different tack? I suspect you are forming the text1, text2... with code that looks something like this:
my $counter = 1; foreach (lameExcuse()){ $token = 'text' . $counter++; doSomethineWith($token)}
And later you're having to sort these tokens. If you instead
my $token = 'text00001'; foreach (lameExcuse()){ doSomethineWith($token++)}
You'll generate tokens text00001 text00002 text00003... which sort quite nicely up to 100K tokens.

throop

Actually, it works OK beyond 100K; you just roll over to 'texu00000'