in reply to Re: Reading files n lines a time
in thread Reading files n lines a time
Hmm looked through my test script and yes it seems that the while(<>){$nextline=<>;$thirdline=<>} can actually be extended indefinetly. It is ugly but gets the job done.
Why my scripts crashed seems to be of the undefined variables you get when your text files line number is not divisible by the number of your $nextlines. Then in the end you will get undefined variables for your $nextlines
I need to get some control element that would terminate the script (or loop if I want to continiue with script) nicely. I think akin to - if any variables undefined exit loop, in the beginning of the loop. Should stop it from panicking with unfavorable Eof situation.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Reading files n lines a time
by choroba (Cardinal) on Dec 06, 2012 at 14:17 UTC | |
|
Re^3: Reading files n lines a time
by naturalsciences (Beadle) on Dec 06, 2012 at 14:12 UTC |