in reply to Writing Multiple Recordsets into a CSV file
open my $fh, q{>}, $datafile or die qq{cant open $datafile to write: $!\n}; my $header_rec = join(",", @{$read_sth->{NAME}}); # print the header to the filehandle print $fh $header_rec . "\n"; while (@data = $read_sth->fetchrow_array) { # lets see what we have die @data; my @data = EQ_Misc::arr_replace_undef("", @data); my $csv_record = join(",", @data); # you're writing the array _and_ the record (and a dot)? #print $fh "@data $csv_record .\n"; # did you mean? print $fh qq{$csv_record\n}; } #close $datafile; close $fh;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Writing Multiple Recordsets into a CSV file
by sudip_dg77 (Novice) on Apr 10, 2008 at 10:02 UTC | |
by apl (Monsignor) on Apr 10, 2008 at 11:35 UTC |