Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

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}};

This @ISA my cool %SIG

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://378686]
[1nickt]: thx chacham. Not sure if it would be more work defining the new acronym or explaining the grey areas of the existing one :-/

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2017-07-22 19:03 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (340 votes). Check out past polls.