- or download this
my %options = (
one => sub {
...
print "Default\n";
},
);
- or download this
if( exists $dispatch{ $action } ) {
$dispatch{ $action }->();
...
else {
$default->();
}
- or download this
&{ $dispatch{ $action } || $default }();
- or download this
while ( chomp( my $opt = <STDIN> ) ) {
&{ $options{ $opt } || $options{ '' } }()
or last;
}