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, ...; }
In reply to Re^3: Specific Regex with Multilines (/s and /m): Why Doesn't This Work?
by ikegami
in thread Specific Regex with Multilines (/s and /m): Why Doesn't This Work?
by elvenwonder
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |