Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^5:Bad Text::CSV_XS parameter

by Tux (Canon)
on Apr 24, 2020 at 20:52 UTC ( [id://11116048]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Bad Text::CSV_XS parameter
in thread Bad Text::CSV_XS parameter

You can use header () even if your CSV does not have a header, if only to detect BOM, eol, and SEP.

open my $fh, "<", "file.csv" or die "$!"; my $csv = Text::CSV_XS->new ({ binary => 1, auto_diag => 1 }); $csv->header ($fh, { bom => 1, set_column_names => 0 }); while (my $row = $csv->getline ($fh)) { # ... }

Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11116048]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-25 14:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found