in reply to Re: How to conditionally execute a subroutine defined as hash value
in thread How to conditionally execute a subroutine defined as hash value
use strict; my %config_A = (A=>'a'); my %config_B = (B=>'b'); my $calls = { A => \&print_A(\%config_A), B => \&print_B(\%config_B), }; my $test = 'A'; $calls->{$test}; sub print_A { my $config = shift(); print $config->{A},"\n"; } sub print_B { my $config = shift(); print $config->{B},"\n"; }
|
|---|