I just looked at that "tutorial", and have to conclude that to be be one of the worst tutorials I have ever seen. THE reason to use a CSV parsing module like Text::CSV_XS or Text::CSV is because, like in the case of the OP, the format is not straightforward: fields may contain " or , or even newlines. Both mentioned modules deal with that transparently.
My advice: DO NOT READ that tutorial. Just read the manual for either module and follow the SYNOPSIS and examples:
my $csv = Text::CSV_XS->new ({ binary => 1, auto_diag => 1 }); open my $fh, "<", "file.csv" or die "file.csv: $!"; while (my $row = $csv->getline ($fh)) { # do something with @$row } close $fh or die "file.csv: $!";
update 2013-11-25: That tutorial has been completely rewritten to reflect the current state of affairs, and is now well worth looking at.
In reply to Re^2: Need help with double quotes and CSV file processing
by Tux
in thread Need help with double quotes and CSV file processing
by vs95054
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |