Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^3: CSV SPLIT

by space_monk (Chaplain)
on Jun 21, 2013 at 05:37 UTC ( #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! :-)


Comment on Re^3: CSV SPLIT
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
Node Status?
node history
Node Type: note [id://1040074]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2014-08-20 07:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (107 votes), past polls