my $PREFIX = '/home/xpost-scripts'; my %xscripts = ( site_a => 'a_funct', site_b => 'b_funct' ); foreach (keys(%xscripts)) { eval { require ("$PREFIX/$_") }; print STDERR "Warning: File $_ had errors: '$@'\n" if($@); } # ... Here, we grabbed the Function name from a DB query. It's a hash for this example. foreach (keys(%xscripts)) { if (defined($xscripts{$_}) && ref($xscripts{$_}) && UNIVERSIAL::isa($xscripts{$_}, 'CODE')) { &$xscripts{$_}("A parameter"); } else { print STDERR "Error. Could not call function $xscripts{$_}\n"; } }