in reply to matching several lines

This was a more elegant solution before I started testing it. This uses the flip flop operator ("..", see perlop) to detect when it's in the delimiters.

my $start = qr/A{6}/; my $end = qr/B{6}/; while ( <DATA> ) { if ( m{$start} .. m{$end} ) { next if m{$start}; next if m{$end}; print; } } __DATA__ hello world0 hello world1 hello world2 AAAAAA this is a test of the emergency broadcast system BBBBBB hello world0 hello world1 hello world2 AAAAAA if this had been a real emergency more instructions would have followed BBBBBB hello world0 hello world1 hello world2 __END__ this is a test of the emergency broadcast system if this had been a real emergency more instructions would have followed

This doesn't produce the blank lines between the text sections like the original one does, but it pulls out the desired text clearly enough. If the blank lines are important, you could do that near one of the nexts.