in reply to Re^4: How to conditionally execute a subroutine defined as hash value
in thread How to conditionally execute a subroutine defined as hash value
Then consider passing the appropriate parameter, depending on $test?
my $config= 'A' eq $test ? \%config_A : \%config_B;
Or even better, do the same for your data as you already did for your code:
my %config= ( A => \%config_A, B => \%config_B, ); my $config= $config{ $test } or die "Unknown test '$test'";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: How to conditionally execute a subroutine defined as hash value
by Anonymous Monk on Apr 02, 2014 at 11:16 UTC | |
by AnomalousMonk (Archbishop) on Apr 02, 2014 at 17:52 UTC |