foreach my $x (@array) { my @cols = split /;/, $x; my $sth = $dbh->prepare("insert into table (a,b,c,d) values (?,?,?,?)") or die $dbh->errstr; $sth->execute(@cols) or die $sth->errstr; $sth->finish or die $sth->errstr; }