# Define a list of 'actions' by listing function names my %function = map { $_ => \&$_ } qw[ post read default ]; # ... my $action = something(); # Wherever you get it $function{$action}->(@somestuff); # Pass any parameters