in reply to Re^2: How to set variable names using Text::CSV?
in thread How to set variable names using Text::CSV?
IMHO binary should have been the default when the module was created, but that was before I took over. Now we have to keep backward compatibility. There are two reasons to always pass binary
Of course, when it is your own data, and you generate it yourself, feel free to leave it out, but it is the most given solution I have to give to people that sen me mail with "Text::CSV_XS is broken" subjects.
auto_diag is a rather new attribute that calls error_diag () at the moment the error occurs, so you will (hopefully) never wonder why something went wrong.
There is no difference between
my @names = @{$csv->getline ($io)}; # note the @{...} $csv->column_names (@names);
and
my @names = @{$csv->getline ($io)}; # note the @{...} $csv->column_names ( [ @names ] ); # extra whitespace for attention
which is essentially the same as
$csv->column_names ($csv->getline ($io));
when you do not intend to use @names after the column assignment. The order is the same for all. If you need the headers later, you can still use
my @names = $csv->column_names ();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How to set variable names using Text::CSV?
by Anonymous Monk on Oct 18, 2009 at 11:11 UTC | |
by Tux (Canon) on Oct 19, 2009 at 12:45 UTC |