Not quite sure what you want ...
After creating the DBI object, you can use it again and again. Here I read the SQL statement after the SQL statement from the file and process everything in order:
use DBI;
my $sqlFile = "/home/user1/tools/mytest.sql"
my $dbh = DBI::Connect->new($connect, $user, $password)
or die("Can't access db");
open (SQL, "$sqlFile")
or die("Can't open file $sqlFile for reading");
while (my $sqlStatement = <SQL>) {
$sth = dbi->prepare($sqlStatement)
or die("Can't prepare $sqlStatement");
$sth->execute()
or die("Can't execute $sqlStatement");
}
, SQL prepare, , SQL. ?