Subject: | \t doesn't work in _XS, works in _PP |
The following code works, however _XS, does not work. _XS will not
accept '\t', or "\t" as sep_char. It will still use ',' as the sep_char.
This causes problems with DBD::CSV too.
Trying to process the tab file in DBD::CSV, it will fail silently. In
Text::CSV_XS you can see setting sep_char has no effect..
use Text::CSV_PP;
use Data::Dumper;
my $csv = Text::CSV_PP->new({ sep_char => "\t" });
open (my $fh, '<', 'db.csv');
while ( <$fh> ) {
$csv->parse($_);
print Dumper [ $csv->fields ]->[23];
}
Subject: | db.csv |
Message body is not shown because it is too large.
Subject: | proc.pl |
#!/usr/bin/perl -l
use strict;
use warnings;
use Text::CSV_PP;
use Data::Dumper;
my $csv = Text::CSV_PP->new({ sep_char => "\t" });
open (my $fh, '<', 'db.csv');
while ( <$fh> ) {
$csv->parse($_);
print Dumper [ $csv->fields ]->[23];
}