You would have to maintain your own list as you go:
my $check = 'abcdefghijk'; my (@matches_start, @matches_end); for (0 .. 9) { $check =~ /efg/; push @matches_start, $-[0]; push @matches_end, $+[0]; }
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated
In reply to Re: positions of all regexp matches
by hardburn
in thread positions of all regexp matches
by glwtta
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |