my $prev = ''; LINE: while ( <> ) { next LINE if "$prev$_" =~ m/\.{4}/s .. /(\+\=\+)$/; print; $prev = $_; }