/m multiple lines
^ will match beginning of line
$ will match end of line
\A still matches beginning of string
\z
\Z
#!/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;
}