Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Display last record

by ikegami (Patriarch)
on Dec 31, 2005 at 21:20 UTC ( [id://520192]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://520192]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-04-19 23:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found