Created
March 6, 2015 17:21
-
-
Save Tux/f781bdefeb190e12a265 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sh$ for i in $(seq 1 1000000); do echo 'hello,","," ",world,"!"'; done > /tmp/hello.csv | |
sh$ cat cat csv-ip5xs.pl | |
#!perl6 | |
use v6; | |
use Slang::Tuxic; | |
use Inline::Perl5; | |
my $p5 = Inline::Perl5.new; | |
$p5.use ("Text::CSV_XS"); | |
my @rows; | |
my $csv = $p5.invoke ("Text::CSV_XS", "new") | |
or die "Cannot use CSV: ", $p5.invoke ("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; | |
$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment