in reply to Perl script run foreach loop and sort without having to save and reopen the filehandle each time.
Look into Tie::File as a way to manipulate the contents of your output file as an array - easy to add or change records in the file. Also, is there a reason you can't apply your final criteria the first time you write to the output file?
As a side note, your seek $in, 0, 0 after reopening the file is superfluous. The file pointer will already be at the beginning of the file on open.
|
|---|