in reply to Reading files n lines a time
Depending on the way your files-which-need-to-be-read-four-lines-at-a-time (henceforward, "fwn") are formatted/organized and the consistency thereof, you might consider setting your $/ record separator...
for ex, if data looks like:
name date bill name1 date1 bill1 ...
then setting local $/="\n\n" will tell Perl that you want to read a paragraph from the fwn, where paragraph is defined as something ending in two consecutive newlines. Better yet, the special case, $/="" defines para somewhat more broadly and may be suitable to deal with your data.
You'll find many examples here, if you merely SuperSearch for $/
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Reading files n lines a time
by naturalsciences (Beadle) on Dec 06, 2012 at 14:00 UTC | |
by ww (Archbishop) on Dec 06, 2012 at 20:27 UTC | |
by naturalsciences (Beadle) on Dec 07, 2012 at 17:45 UTC | |
by ww (Archbishop) on Dec 07, 2012 at 19:22 UTC | |
by naturalsciences (Beadle) on Dec 07, 2012 at 19:51 UTC |
In Section
Seekers of Perl Wisdom