in reply to Re^2: Specific Regex with Multilines (/s and /m): Why Doesn't This Work?
in thread Specific Regex with Multilines (/s and /m): Why Doesn't This Work?
But I don't because I'm pushing each into an array individually, right?
Depends. As long as you can only have one match per line, then yes, the following would do:
while (<>) { if (/.../) { push @matches, ...; } }
If you can have multiple matches per line, you'd need something like:
while (<>) { while (/.../g) { push @matches, ...; } }
It's moot, however, since you want to match text that span multiple lines. You want something more like the following:
my $file; { local $/; $file = <>; } # Slurp file. while ($file =~ /.../g) { push @matches, ...; }
|
|---|