my %CODE = ( one => \&one, two => \&two, three => \&three, _default => \¬_found, ); my $input = whatever; ($CODE{$input} || $CODE{_default})->(@arguments);