Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Reading CSV Function

by swl (Parson)
on Jun 15, 2021 at 03:08 UTC ( [id://11133877]=note: print w/replies, xml ) Need Help??


in reply to Reading CSV Function

Just a general piece of advice, but it's best to avoid hand-rolling your own CSV parser. Use Text::CSV instead, preferably with Text::CSV_XS also installed so you get the speed boost.

As for handling arguments, you can use Boolean assignment in many cases. For example this

$columnSeperatorChar = "," if ($columnSeperatorChar eq "");

can be written as

$columnSeperatorChar ||= ",";

(assuming you will never use a 0 as a column separator)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-03-29 06:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found