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

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"}; }