# untested my $action = shift; my %actions = ( options => \&get_options, config => \&read_config ); $actions{$action}->(); sub get_options { # get options } sub read_config { # read config }