- or download this
my $bar = sub { # do something here };
$bar->(); # executes the stuff in the anonymous sub above
- or download this
sub foo {
# do something here
...
my $bar = \&foo;
$bar->(); #executes the stuff in foo()
- or download this
my %actions = (
foo => \&do_foo, # some long operation
...
else {
$actions{ default }->();
}