$Dispatch = ("foo" => \&foo_func, "bar" => \&bar_func,); $action = $q->get_this_action(); if (exists $Dispatch->{$action}) { $Dispatch->{$action}->(@args_that_everyone_gets); } else { # no action, do the default, if any }