use warnings;
use strict;
my @files = qw(a.txt b.txt);
for my $file (@files){
open my $fh, '<', $file or die $!;
my $sep = 0;
print "working on file $file\n";
while (<$fh>){
if (/^\+[-=]/){
$sep++;
if ($sep > 1){
print "skipping $file\n";
last;
}
next;
}
$sep--;
chomp;
print "$_\n";
}
}
####
+=======+=======+============+============+============+
+-------+-------+------------+------------+------------+
####
+=======+=======+============+============+============+
line 1
line 2
+-------+-------+------------+------------+------------+
####
working on file a.txt
skipping a.txt
working on file b.txt
line 1
line 2