Perl multiple line matching while reading from file, line by line

lines, perl, regex

Solution

It's often simplest just to read the entire file at once.

my $file;
{
   local $/;
   $file = <$fh>;
}

Problem

Lets say I open a file like this: ``` #!/usr/bin/perl open FILE, "8882099"; while ($line = <FILE>) { if ($line =~ /accepted by(.*?)\./s) { print "accepted by: $1"; } } ``` the problem is the regex is working, but since the file is read line by line, how should I go about matching this string which continues on to a new line? Thank you

Original source