Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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
Re^2: Display last record
by Happy-the-monk (Monsignor) 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 exploiting the Monastery: (9)
As of 2014-12-25 22:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (163 votes), past polls