my $pat = qr{Summary \w+\(\w\)}; while() { if (/$pat/ ... /$pat/) { next if /$pat/; print; } } __END__ gargantua pantagruel Summary 1000(1) top Date .... Column1 Col2 Col3 bottom Summary xxx(x) foo bar baz