in reply to printing database rows in a file

I'll second DBI and MIME::Lite. You may also be interested in using SpreadSheet::WriteExcel or Text::CSV for writing your file, depending on what your data looks like.

Replies are listed 'Best First'.
Re^2: printing database rows in a file
by Tux (Canon) on Oct 22, 2010 at 10:54 UTC

    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