On 14/01/16 08:15, H.Merijn Brand wrote:
Here's an example of ported DBI code:

use v6;
use Inline::Perl5;

my $p5 = Inline::Perl5.new;


my @rows;
my $csv = $p5.invoke("Text::CSV_XS", "new")
     or die "Cannot use CSV: ", $p5.invoke("Text::CSV_XS", "error_diag");

my Int $sum = 0;
for lines() {
     $sum += $csv.fields.elems;

Please note, that the code could be a bit simpler:

    use v6;
    use Text::CSV_XS:from<Perl5>;
my $csv = Text::CSV_XS.new() or die "Cannot use CSV: " ~ Text::CSV_XS.error_diag();

That should work. For more information, see the Readme of Inline::Perl5, which also has a whole bunch of examples.

  - Timo

Reply via email to