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.

1 Peter 4:10
  • Comment on Re: Perl script run foreach loop and sort without having to save and reopen the filehandle each time.
  • Select or Download Code