Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Splitting a file based on matched conditions

by Anonymous Monk
on Sep 19, 2017 at 13:02 UTC ( #1199668=note: print w/replies, xml ) Need Help??


in reply to Splitting a file based on matched conditions

To read "the last line" of any file, seek() to a position relative to the end-of-file, that you know is far-enough back to encompass the last few lines, then start reading. (If the file might be UTF-8 then you need to be prepared to ignore UTF-8 errors on the off-chance that your seek put you smack in the middle of a multibyte sequence.) You really want to be sure that you read more-than-one line in this way so as to be very certain that the last line you read is complete.
  • Comment on Re: Splitting a file based on matched conditions

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1199668]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2018-07-20 07:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (426 votes). Check out past polls.

    Notices?