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 |