The stupid question is the question not asked | |
PerlMonks |
Re: writing to the top of a fileby BrowserUk (Patriarch) |
on May 20, 2004 at 03:36 UTC ( [id://354845]=note: print w/replies, xml ) | Need Help?? |
Unless reads from this file are considerably more frequent than writes, reading the whole file and then re-writing it with the new stuff at the top in order to speed up reads will have dubious benefit. If the reads and writes are paired (equal numbers of each) then one cycle of 'Writing to the end of file + reading the whole file to get the last line' compares favourably with 'Reading the whole file, writing the new line and then re-writing the whole file + reading the first line'. You would almost certainly be better of writing new stuff to the end, and then using File::ReadBackwards or a similar technique to retrieve it. Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham"Think for yourself!" - Abigail
In Section
Seekers of Perl Wisdom
|
|