in reply to Is there a way to read a file backwards?

For the sake of completeness, you might also use backticks to capture the output of the Unix tail command (provided you're on a platform where it's available). Speedwise it's not too bad, depending on the cost of invoking a new process compared to file access times and such. You might also use a combination of seek and sysread, but you'll have to search for line endings (newlines) yourself. The search will be somewhat expensive.

Go with File::Backwards.

  • Comment on Re: Is there a way to read a file backwards?