Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: reference to a sub

by Zaxo (Archbishop)
on Sep 11, 2005 at 07:30 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-19 02:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found