in reply to Re^3: multiline regex: heredoc vs. reading file
in thread multiline regex: heredoc vs. reading file

OK, so I changed the while loop to contain the following, and still get the same thing -
$_ .= <TEST>; if (m{ \w+\n .+ \w+ }msx) { print "reading file test: The line \n$_\nmatches.\n"; }
I would think that
a) $_ .= <TEST>; would be equivalent to your $text = <$test_fh>; line, and
b) replacing \n with .+ utilizes the /s,

correct?

Replies are listed 'Best First'.
Re^5: multiline regex: heredoc vs. reading file
by ikegami (Patriarch) on Jan 25, 2006 at 18:13 UTC
    Now, $_ contains two lines, but you need three with the data you showed. Also, $_ .= <TEST> could attempt to read past the end of the file, but you don't check for that.