in reply to Display last record

Have you looked at File::ReadBackwards? It reads a file line by line from the end of the file. It does so efficiently. It doesn't read the entire file, much less load it entirely into memory.

Replies are listed 'Best First'.
Re^2: Display last record
by davido (Cardinal) on Jan 01, 2006 at 05:22 UTC

    Just to add to what ikegami said, File::ReadBackwards will not only read the file line by line, starting at the end of the file and working backwards, but it will read record by record (which usually is line by line, but doesn't have to be). This is a pretty flexible solution. In fact, unlike the plain old <> operator, File::ReadBackwards allows you to set the record separator based on either literal text, or a regular expression. Nice!


    Dave