my %sub_named = ( this => \&this, that => \&that, ); my $ref = 'this'; my $x; if ( exists $sub_named{ $ref } ) { $x = $sub_named{ $ref }->(); } else { # error, no sub named $ref }