.... my $calls => { A => { sub_ref => \&print_A, config_ref => { ... } }, B => { sub_ref => \&print_B, config_ref => { ... } } }; my $test = 'A'; my $sub = $calls->{$test}{sub_ref}; my $config = $calls->{$test}{config_ref}; $sub->( $config );