unshift @fields, qw(hostname host_id); my $insert = "INSERT IGNORE INTO $thisTable (" . join(", ", @fields) . ") VALUES (" . join(",", ('?') x @fields) . ")"; while (my @row = $dbq->fetchrow_array) { my $this_insert = [ $site_hostname, $site_id, @row ]; push @central_insert, $this_insert; } #### my $sth = $dbh->prepare($insert); $sth->execute(@$_) for @central_insert;