The stupid question is the question not asked | |
PerlMonks |
Re: read a file twice...by wardk (Deacon) |
on Apr 15, 2002 at 17:36 UTC ( [id://159277]=note: print w/replies, xml ) | Need Help?? |
This sort of issue comes up alot in my shop with generating log files, typically
for a scheduled "batch" job. the logfile for usability purposes needs the totals, stats, etc
at the top of the log with any detail info after.
To avoid processing twice (it's usually processing a SQL cursor, but occasionally a flat file too), we typically use the method mentioned by thor.... read the file once, saving the lines to be printed afterward in one or more arrays, then pushing them out at the end.
In Section
Seekers of Perl Wisdom
|
|