in reply to Re: perl6 match variable
in thread perl6 match variable

Issue #118705 is marked as resolved but the problem is still there ??
for 1 { say "foo".subst: /(foo)/, {$/[0] ~ "o"}; } #gives # Use of Nil in string context in block at <unknown file>:1 # o
tested with perl6 version 2015.11-1-ge88196a built on MoarVM version 2015.11

Replies are listed 'Best First'.
Re^3: perl6 match variable
by raiph (Deacon) on Nov 24, 2015 at 04:18 UTC
    Bug 118705 talked about a similar looking set of bugs with the `s///` construct. This construct is a variant of, but not identical to, the `subst` function. It looks like a similar fix will have to be applied separately for `subst`. I've just filed a new `subst` specific bug report.

    Afaict the bug is omission of an automatically added `-> $/` signature. One workaround is to manually add the missing piece:

    for 1 { say "foo".subst: /(foo)/, -> $/ {$/[0] ~ "o"}; }