Your specific DBD driver might have a method to do it for you. Barring that, you could try:
my $sql_file = '/path/to/file.sql';
my $dbh; # DBI connection initilized elsewhere
local $/ = ';';
open(SQL, '<', $sql_file) or die "Can't open $sql_file: $!\n";
while(my $line = <SQL>) {
$dbh->do($line)
or warn "Can't execute statement in $sql_file, line $.: " . $d
+bh->errstr;
}
close(SQL);
Though there might be some special cases where the above
will fail.
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated