eval('&' . $action . '()'); if( $@ ) { die "Usage\n"; } #### my $subref = \&{$action}; die "Usage" unless defined &$subref(); #### my %dispatch = ( 'this' => \&do_this, 'that' => \&do_that, ); if (defined $dispatch{$action}) { &$dispatch{$action}; } else { die "Usage\n"; }