in reply to Re^3: Hmmm: while(), file handle and $_ gotcha
in thread Hmmm: while(), file handle and $_ gotcha

Cool! And then perhaps:

while (<DATA>) { if ($. % 10 == 1) { print; print scalar(<DATA>) for(0..3); } }

Replies are listed 'Best First'.
Re^5: Hmmm: while(), file handle and $_ gotcha
by ikegami (Patriarch) on Mar 06, 2009 at 16:15 UTC
    Since we want to print the first 5 lines of each group of 10,
    while (<DATA>) { print if ($. - 1) % 10 < 5; }