for(@ar1){ $values=join ', ',(map {$_="'$_'"},@$_); chop $values; $dbh->do("INSERT INTO `tabe` (foo,bar,set,baz) VALUES $values"); }