Jonathan Scott Duff wrote: > How do C<&> and C<&&> differ with respect to backtracking? For instance, > > "foobar" ~~ / <[a..z]>+ & [ ... ] /; > > Both sides of the C<&> happen in parallel, so I would guess that they > both match "foo" then stop. Please correct me if that's wrong.
As written, this match would fail, since '<[a..z]>+' would match "foobar" while '[ ... ]' would match "foo". '&' requires that both sides match the same start and end points. I suppose that it might be worth considering requiring only the start points to match, and having the conjoined match use the earliest end point; so that the above match would then match "foo" instead of failing. But it's entirely possible that there's something faulty with this approach. The difference between '&' and '&&' is that '&' evaluates the two sides in an arbitrary order, possibly even in parallel; '&&' always evaluates the left side first, and only bothers with the right side if the left side matched. -- Jonathan "Dataweaver" Lang