sub do_something { my ($function) = @_; $function = 'default' unless exists $functions{$function}; $functions{$function}->(); }