I have two questions:

1. I open a CSV file and parse it. If it does not exist I create it.  Immediately after the program I try to open the csv file with MS-Excel, it gives error in reading.

2. How do I write and or append to the file in CSN format, an array of values in a single column?

 

Here is my code:

 

my $csv = Text::CSV_XS->new({ 'sep_char' => $sep_char }),

$filepath = 'c:/example.csv';

open(my $fh, ">>$filepath")     or die "Could not open file - $filepath - $!";

while (<$fh>) {

            my $line  = $_;

            $csv->parse($line);

            my @fields  = $csv->fields();

            for $column (@fields) {

                        print " =>  $column\n";

            }

}

close($fh);

 

 

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to