in reply to Sorting a text file

You could easily adapt the answer I gave to your question yesterday. Simply take out the @wanted array and the $rxExtract regex and replace the

grep { $_->[2] =~ $rxExtract }

with

sort { $a->[2] <=> $b->[2] }

Note that I have used a numerical comparison in the sort (<=>) just in case your second column has numbers of other than four digits. If there will always be only four digits you could use string comparison (cmp).

I hope this is of use

Cheers,

JohnGG