- or download this
#!/usr/bin/perl -w
use strict;
...
my $f = 'foo';
&$f;
- or download this
my %ops = (
one => \&one,
two => \&two,
...
my $op = $q->param( 'op' );
die "Invalid operation '$op'\n" unless exists $ops{ $op };
$subs{ $op }->();
- or download this
my $op = $q->param( 'op' );
my $sub = __PACKAGE__->can( $op );
die "Invalid op '$op'\n" unless $sub;
$sub->();