in reply to Sorting a text file

This is a FAQ:

Searching with Google or typing perldoc -q sort gives you How do I sort an array by (anything). You will need to split up your lines into separate items or at least extract the items for the comparison, for example by using

sort { substr($a,8,4) cmp substr($b,8,4) }

Please also show the code you've written. It is very hard to give you helpfull advice if we cannot see your code and have to guess as to what you have tried and where your problem might be.