Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: eval'ing coderef with ampersand

by hbm (Hermit)
on Sep 07, 2010 at 13:13 UTC ( [id://859159]=note: print w/replies, xml ) Need Help??


in reply to Re: eval'ing coderef with ampersand
in thread eval'ing coderef with ampersand

That is a subtle and significant difference. What I'm really doing is forking a list of processes; and I was alarmed that one process executed when I defined the list, prior to forking.

Do you know where this is documented? I haven't seen it in perlref, my Cookbook, or elsewhere.

Thanks!

Replies are listed 'Best First'.
Re^3: eval'ing coderef with ampersand
by ikegami (Patriarch) on Sep 07, 2010 at 17:45 UTC

    perlop says "Unary '\' creates a reference to whatever follows it." and refers you to perlref.

    perlref shows special that \&handler is the means of getting a reference to a function.

    \handler and \handler() are clearly not special cases, so the \ applies to the value returned by the expressions that follows. They could be written \( handler ) and \( handler() ).

    The behaviour of \&handler() is not documented, but there's only one parsing that wouldn't result in an error: \( &handler() ).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-19 23:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found