in reply to Range Operator Mysteries

This is untested but looks reasonable.

#!/usr/bin/perl -w use strict; my $delimiter = qr/================================/; my $counter = 0; # If the first line of every input file is a delimiter, you # can comment this out and the first output file will be # opened on the first iteration of the while() loop. open FH, ">file$counter" die "could not open file$counter: $!"; # Read each file in @ARGV or stdin one line at a time while (<>) { if (/$delimiter/) { # If we hit a delimiter, close the currently # open file, and open a new one. $counter++; close FH; open FH, ">file$counter" or die "could not open file$counter: $!"; } else { # Any line other than a delimiter goes into # the currently open file print FH; } }

-Matt