Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^4: Bad Text::CSV_XS parameter

by pcouderc (Monk)
on Apr 24, 2020 at 15:09 UTC ( #11116024=note: print w/replies, xml ) Need Help??


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

Thank you, you got it !
if I remove the BOM with vim, it works...

Thank you very much, even if I cannot use "detect_bom => 1" in this case as there is no header...

Replies are listed 'Best First'.
Re^5:Bad Text::CSV_XS parameter
by Tux (Canon) on Apr 24, 2020 at 20:52 UTC

    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
    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://11116024]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2022-05-19 21:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (72 votes). Check out past polls.

    Notices?