This is line one. Line Two is this. Third line starts here. This is line four. This is line five. This is line six. This is the seventh line. This is line eight. #### use strict; use warnings; open my $fh, "+<", "testlines.txt"; while (<$fh>) { if ($_=~ /(third | four)/si) { chomp; local $/ = "\n\n"; print "line is: $_\n"; } } #### >perl regex.pl line is: Third line starts here. line is: This is line four. #### This is line one. Line Two is this. Third line starts here. This is line four