Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Passing subroutines as arguments

by dpuu (Chaplain)
on May 08, 2003 at 19:47 UTC ( [id://256653]=note: print w/replies, xml ) Need Help??


in reply to Passing subroutines as arguments

The arrow operator:
sub a { my ($sub) = @_; $sub->(4) } sub b { print @_ }; a(\&b);
If you're trying to be lisp-like, you probably also want to look into closures:
a( sub {print @_} )
--Dave

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-25 09:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found