# Here you take the reference to the subroutine my $calls = { A => \&print_A, B => \&print_B, }; # Here you call the subroutine $calls->{ $test }->(\%config_A);