in reply to Why is while(m//g){} so much slower than s///eg and what can I do about it?

Perl 5.6 offers the @- and @+ arrays. The 'perlvar' documentation. You can use
$prematch = substr($string, 0, $-[0]); $match = substr($string, $-[0], $+[0] - $-[0]); $postmatch = substr($string, $+[0]); $paren_1 = substr($string, $-[1], $+[1] - $-[1]); # ...
This may help you in your efforts.

japhy -- Perl and Regex Hacker
  • Comment on Re: Why is while(m//g){} so much slower than s///eg and what can I do about it?
  • Download Code