in reply to text files

If your file consists of blocks separated by (say) 60 *'s, you could do this:
$/ = '*' x 60 . "\n"; while (my $block = <>) { # Do something to $block... print $block; }
On every iteration, $block will consist of all lines until the next line "******...\n" (including that line).

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.