Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Anonymous Subroutines

by dsb (Chaplain)
on Jul 30, 2004 at 13:50 UTC ( [id://378686]=note: print w/replies, xml ) Need Help??


in reply to Anonymous Subroutines

An anonymous subroutine is a reference to a subroutine. For lots of infor: perlref.

For the quick rundown:
Sub routines can be referenced, and then later dereferenced for access. Useful if you need to create an option handler or something:

$opt = "opt" . $ARGV[0]; $subhash = { opt1 => sub { print "This is option one"; }, opt2 => sub { print "This is options two"; } }; # indicate a function when dereferencing with & &{$subhash->{$opt}};


dsb
This @ISA my cool %SIG

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2024-04-18 17:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found