On 1/28/2010 5:51 PM, Pierre Chevalier wrote:
while ( my @list = $get->fetchrow_array) { print join(',', @list), "\n"; }
It throws some insulting messages, though: Use of uninitialized value $list[5] in join or string at ./crosstab_perl.pl line 24. Use of uninitialized value $list[6] in join or string at ./crosstab_perl.pl line 24. Use of uninitialized value $list[7] in join or string at ./crosstab_perl.pl line 24.
Yeah, you can ignore them. Fields that are null in the database will be converted to undef in perl, which when printed spits out that warning. Right before the print, we could test for undef and set them to empty string like:
map { if (!defined($_)) {$_ = '';}} @list; so the while loop would look like: while ( my @list = $get->fetchrow_array) { map { if (!defined($_)) {$_ = '';}} @list; print join(',', @list), "\n"; } -Andy -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general