Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: reference to a sub

by Zaxo (Archbishop)
on Sep 11, 2005 at 07:30 UTC ( #491026=note: print w/replies, xml ) Need Help??


in reply to reference to a sub

A dispatch table

my %dispatch_table = ( foo => \&foo, bar => sub { mumble; }, );

A sub returning a sub generated on the fly, maybe a closure,

sub generate { my $foo = shift; sub { $foo }; }

A variable routine to be called,

sub callit { my $sub = shift; $sub->(@_); }

Overriding a sub,

# in a scope . . . local *foo = generate 'bar';

The list goes on . . .

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: reference to a sub (Callbacks)
by data64 (Chaplain) on Sep 11, 2005 at 17:53 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2022-10-01 16:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (3 votes). Check out past polls.

    Notices?