On every iteration, $block will consist of all lines until the next line "******...\n" (including that line).$/ = '*' x 60 . "\n"; while (my $block = <>) { # Do something to $block... print $block; }
Just remember, every block contains multiple lines! This is important if using s/.../.../ in your processing.
See perlvar for more information about the wondrous $/ variable.
Originally posted as a Categorized Answer.
In reply to Re: text files
by ariels
in thread text files
by polr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |