11.29. /m multiple lines

^ will match beginning of line
$ will match end of line

\A still matches beginning of string
\z
\Z

Example 11-8. examples/regex/find_letter_change.pl

#!/usr/bin/perl
use strict;
use warnings;

#../regex/examples/text/american-english
my $filename = shift or die;

my $data;
{
    open my $fh, '<', $filename or die;
    local $/ = undef;
    $data = <$fh>
}
if ($data =~ /(^a.*\nb.*\n)/mi) {
    print $1;
}


If you are interested in on-site trainings by the author, please contact me directly.

Online courses:

Would you like to get
updated when I publish
the next article?

Follow me:

Google Plus Twitter RSS feed