in reply to Low-threshold function in Text::CSV_XS

I'd rather like a function like this:

my $CSV = openCsv (file => "file.csv", headers => "auto"); while (my $row = <$CSV>) { print "$row->{Foo} has $row->{Bar} bar(s)\n"; }

There is nothing preventing READLINE() of a tied handle from returning an array or hash reference.

Jenda
Enoch was right!
Enjoy the last years of Rome.

Replies are listed 'Best First'.
Re^2: Low-threshold function in Text::CSV_XS
by Tux (Canon) on Jan 30, 2014 at 12:20 UTC

    I understand the request, but I see this syntax as too conflicting with the existing syntax.

    IF a function like that is to return an object of any kind, it would be a Text::CSV_XS object, more like this:

    my $csv = openCsv (file => "file.csv", headers => "auto"); while (my $row = $csv->getline) { # note the missing $io say $row->{Foo}; }

    This fits nicely in the rest of the code and documentation and I will consider something like this (no promises).


    Enjoy, Have FUN! H.Merijn