Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Display last record

by TedPride (Priest)
on Dec 31, 2005 at 18:32 UTC ( #520178=note: print w/ replies, xml ) Need Help??


in reply to Display last record

Just move the file pointer to the end of the file minus whatever the maximum record size is, then read everything to the end of the file and extract the last record. This should be quite efficient even with huge files.


Comment on Re: Display last record
Replies are listed 'Best First'.
Re^2: Display last record
by Happy-the-monk (Abbot) on Dec 31, 2005 at 18:43 UTC

    Just move the file pointer to the end of the file minus whatever the maximum record size is, then read everything

    Without example code to back it up, this must look quite a bit obscure to a newbee.

    Being concerned of large files I would opt for the answer in perlfaq5 to perldoc -q "a line in a file" and use Tie::File.

    Cheers, Sören

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (14)
As of 2015-09-03 22:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred temperature scale is:










    Results (126 votes), past polls