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

The match object $/ in not visible on its own because subst evaluates the regex in a different scope.

Does it? Because when I write, e.g:

say "foo".subst: /(fo)o/, {$/[0].flip}

I get, as I expected, "of"

Replies are listed 'Best First'.
Re^3: perl6 match variable
by jeckyhl (Novice) on Sep 10, 2014 at 21:32 UTC

    And now let's try

    for dir(".") -> $file { say "foo".subst: /(fo)o/, {$/[0].flip}; last; }

    guess what happens ?...

    we get an empty string!