my $table = 'table'; my @cols = (qw( a b c)); $" = ", "; $dbh->do ("COPY $table (@cols) FROM STDIN"); while (...) { $dbh->pg_putline (join ("\t", @values) . "\n"); } $dbh->pg_endcopy; $dbh->commit;