in reply to Re: printing database rows in a file
in thread printing database rows in a file

DBI + Text::CSV_XS + PerlIO::gzip =>

use DBI; use PerlIO::gzip; my $sth = $dbh->prepare ("select * from table"); $sth->execute; my $csv = Text::CSV_XS->new ({ binary => 1, auto_diag => 1 }); open my $fh, ">:gzip", "output.csv.gz" or die "output.csv.gz: $!"; while (my $row = $sth->fetch) { $csv->print ($fh, $row); }

If needed add the :encoding(utf8) layer


Enjoy, Have FUN! H.Merijn