Ok, that clarifies things. Now that I understand what is happening, it is 
straightforward to recognise and fix the problem. A sentence in the 
documentation might help other perl 5 transitioners from getting bitten, 
perhaps at the explanation of the * quantifier. 

> On 21 Sep 2016, at 6:35 PM, Sam S. via RT <perl6-bugs-follo...@perl.org> 
> wrote:
> For the record the problems the auto-advance feature causes even in Perl 5 
> (where embedded code blocks are experimental and rarely used), are twofold:
> 1) Writing an infinite loop can be indicative of a programmer mistake, and 
> the auto-advance feature hides it by making the regex "do something" (which 
> may or may not be what the programmer intended) instead of hanging (which 
> would have caused the programmer to re-write the regex).
> 2) It can cause mysterious-seeming double captures. When there is a capture 
> group in a quantified zero-width assertion, it will capture the same thing 
> twice, because auto-advance kicks in when the cursor has not advanced after 
> *two* iterations. Now, Perl 5 lets repeated captures of the same capture 
> group overwrite each other, so this does not normally show up other than as a 
> performance degradation (whereas in Perl 6 it would cause the same 
> sub-matches to appear twice  in $/). But it can show up in even Perl 5 with 
> `while(m//g) { }` global matching. I remember a discussion on perlmonks a few 
> years ago, where even experienced Perl hackers were tearing their hair out 
> trying to figure out why such a while loop iterated over the same match twice.

Reply via email to