# New Ticket Created by Moritz Lenz
# Please include the string: [perl #88340]
# in the subject line of all future correspondence about this issue.
# http://rt.perl.org/rt3/Ticket/Display.html?id=88340 >
10:49 < moritz> rakudo: say '' ~~ /(\w)+$0/; say $0
10:49 <+p6eval> rakudo 4bf132: OUTPUT«a a a»
10:50 < moritz> huh. Is that correct?
10:50 < masak> don't think so.
10:51 * moritz facepalms
10:51 < moritz> $0 is an array
10:51 < moritz> what happens when you interpolate an array into a regex?
10:51 < moritz> you get an alternation, no?
10:52 * moritz presents the case to the Regex High Court of TimToady,
pmichaud and sorear
10:52 < moritz> is that another "doctor, it hurts when I do this"? :-)
10:52 < masak> no.
10:52 < masak> this is bad.
10:53 < masak> you're clearly not intending $0 as an array, but as a
submatch string.
10:54 < moritz> rakudo: say 'abcd' ~~ /(.)+$0/; say $0
10:54 <+p6eval> rakudo 4bf132: OUTPUT«»
10:54 < moritz> rakudo: say 'abca' ~~ /(.)+$0/; say $0
10:54 <+p6eval> rakudo 4bf132: OUTPUT«»
10:54 < moritz> rakudo: say 'abcc' ~~ /(.)+$0/; say $0
10:54 <+p6eval> rakudo 4bf132: OUTPUT«abcca b c»
10:55 < moritz> ok that's not what it does
10:55 < moritz> it just takes the last item
I think it is inconsistent that $0 in the regex only matches $0[*-1],
but is reported as the full array outside the regex.
I'm not sure what the desired behavior is.