note
kyle
<p>You could wrap it in a string [doc://eval] like so:
<C>
for my $dbh ( @dbf ) {
die $@ if ! eval "use $dbf; 1";
}
</c>
<p>I might be inclined to put the whole thing in a BEGIN block.
<c>
BEGIN {
my @dbf = ...;
for my $dbf ( @dbf ) {
require $dbf;
$dbf->import();
}
}
</c>
<p>Either way, there's a big security risk if <c>@dbf</c> comes from an untrusted source, but I think the risk is bigger with eval. It might be useful to read the documentation for [doc://use] and [doc://require] to see how close they are to what you want to do.
803365
803365