Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Reading files n lines a time

by Anonymous Monk
on Dec 06, 2012 at 14:19 UTC ( #1007584=note: print w/ replies, xml ) Need Help??


in reply to Reading files n lines a time

Right now you consider 4 lines ... soon it may be 6. Plan ahead. Load the lines into an array by pushing them onto the end of it; noting when you've reached end-of-file e.g. if there should be less than 4 lines or you've run out. Each time you loop back, shift the first line off the array and push a new line onto the other end. The lines can be reached directly by indexes 0..3.


Comment on Re: Reading files n lines a time

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2014-10-26 09:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (153 votes), past polls