in reply to Question about regex.

A little line shuffling and error checking fixes this:
use strict; use warnings; open (my $fh, "<", "testlines.txt") or die "$!"; local $/ = "\n\n"; while (<$fh>) { if ($_=~ /(third | four)/si) { chomp; print "line is: $_\n"; } } close $fh;
Code>perl test15.pl line is: This is line one. Line Two is this. Third line starts here. This is line four.

                "Imaginary friends are a sign of a mental disorder if they cause distress, including antisocial behavior. Religion frequently meets that description"