Skip to content

Instantly share code, notes, and snippets.

@Tux
Created April 22, 2015 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tux/de990d9294125224c129 to your computer and use it in GitHub Desktop.
Save Tux/de990d9294125224c129 to your computer and use it in GitHub Desktop.
Text-CSV6 502 > cat csv-parser.pl
#!perl6
use v6;
use Slang::Tuxic;
use CSV::Parser;
my $fh = open "/tmp/hello.csv", :r, chomp => False;
my $parser = CSV::Parser.new (file_handle => $fh, contains_header_row => False);
my int $r = 0;
my int $sum = 0;
while (my $rec = $parser.get_line) {
$r++;
my int $n = +$rec.keys or last;
$sum += $n;
}
$sum.say;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment