The best solution probably uses an ORM system such as DBIx :: Class . They greatly simplify SQL processing.
If you decide to stay on a raw DBI, I would advise you to use prepared statements as follows:
my $query = sprintf 'INSERT INTO %s VALUES(%s)', dbh->quote_identifier($table), join ',', ('?') x $columns;
my $sth = $dbh->prepare($query);
for my $row (@rows) {
$sth->execute(@{$row});
}
It will be speed and reliability.
sub, ORM, , .