Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Passing an anonymous block to a method.

by Aaronrp (Scribe)
on Mar 10, 2011 at 15:48 UTC ( [id://892448]=note: print w/replies, xml ) Need Help??


in reply to Passing an anonymous block to a method.

Are you just trying to avoid the 'sub' keyword?

$obj->method(sub { do something } ) ;

should work, I think.

-- Am I the only one who still cares about RT #67694?

Replies are listed 'Best First'.
Re^2: Passing an anonymous block to a method.
by BrowserUk (Patriarch) on Mar 10, 2011 at 18:48 UTC
    Are you just trying to avoid the 'sub' keyword?

    Effectively yes.

    For the same reasons as 99% of map and grep uses are coded as

    ... = map{ ... } ...

    rather than

    ... = map( sub{ ... }, ... );

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-07-24 09:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.