Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$ cat csv-ip5xs.pl
#!perl6
use v6;
use Text::CSV_XS:from<Perl5>;
my @rows;
my $csv = Text::CSV_XS.new
or die "Cannot use CSV: ", Text::CSV_XS.error_diag;
$csv.binary(1);
$csv.auto_diag(1);
my Int $sum = 0;
for lines :eager {
$csv.parse($_);
$sum += $csv.fields.elems;
}
$sum.say;
$ head -2 /tmp/hello.csv
hello,","," ",world,"!"
hello,","," ",world,"!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment