|Come for the quick hacks, stay for the epiphanies.
Reading a file line-by-line from the bottom upby fx (Pilgrim)
|on Jan 08, 2004 at 00:19 UTC
fx has asked for the wisdom of the Perl Monks concerning the following question:
I can read a file line-by-line from the top down. How would I go about reading it line-by-line from the bottom up?
Under Linux I suppose it would be fairly easy to have my code read standard input and simply tac (like cat, but in reverse) the file into the script. However, I can't guarantee that tac will be available on all systems where this code will run and would therefore prefer to do it with Perl.
The file in question is large (~600Mb) so I'd rather not read it into memory first :)