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

Re: Anonymous Subroutines

by dsb (Chaplain)
on Jul 30, 2004 at 13:50 UTC ( #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


Comment on Re: Anonymous Subroutines
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (11)
As of 2014-12-17 20:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (31 votes), past polls