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

Re^3: CSV SPLIT

by space_monk (Chaplain)
on Jun 21, 2013 at 05:37 UTC ( [id://1040074]=note: print w/replies, xml ) Need Help??


in reply to Re^2: CSV SPLIT
in thread CSV SPLIT

As kcott posted, there are almost no circumstances where you should use split to retrieve or store CSV data due to problems similar to those you've encountered. Text::CSV and its close relatives will happily get/put data between a CSV file and an array, and deal with the separators in data properly by quoting them. Once the row is in the array you can process it anyway you like.

If you post some example data and what you'd like to happen to it, perhaps we can give you a more detailed answer. Don't forget to use <code> tags to show your data in the question properly

If you spot any bugs in my solutions, it's because I've deliberately left them in as an exercise for the reader! :-)

Replies are listed 'Best First'.
Re^4: CSV SPLIT
by serene_monk (Initiate) on Jun 21, 2013 at 05:54 UTC

    hey the cpan gives an error that says " Expected fields to be in an array "

    and the line is

    $status = $csv->print ($io, $colref);

      Well, is $colref a reference to an array in your code or not?

      Post your code and some data, you can modify your original question to do this.

      If you spot any bugs in my solutions, it's because I've deliberately left them in as an exercise for the reader! :-)

Log In?
Username:
Password:

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

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

    No recent polls found