my ($_merid,$_mertype) = $dbh->selectrow_array(qq{SELECT `id`,`type` FROM `merchants` WHERE #SomeWhereStatement#}); require "/path/to/modules/$_mertype.conf"; my $_subvar = $_mertype . "chargeCard"; my $cardCharged = &$_subvar($_merid);