# New Ticket Created by Faye
# Please include the string: [perl #126249]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=126249 >
$ perl6 -e 'my token foo { foo { say $/.to } }; "foo" ~~ /<foo>/'
3
$ perl6 -e 'my token foo { {} foo { say $/.to } }; "foo" ~~ /<foo>/'
0
It seems that $/ is constructed only in the first code block of a regex, and
not reconstructed for subsequent blocks. Compare to $¢, which reports the right
position in any case:
$ perl6 -e 'my token foo { foo { say $¢.pos } }; "foo" ~~ /<foo>/'
3
$ perl6 -e 'my token foo { {} foo { say $¢.pos } }; "foo" ~~ /<foo>/'
3
Note that trying to construct a Match from the Cursor doesn't work around the
issue:
$ perl6 -e 'my token foo { {} foo { say $¢.MATCH.to } }; "foo" ~~ /<foo>/'
0