Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: perl6 match variable

by grondilu (Friar)
on Sep 10, 2014 at 09:56 UTC ( [id://1100109]=note: print w/replies, xml ) Need Help??


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!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1100109]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-03-29 07:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found