Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: parse_csv (Cookbook)

by serf (Chaplain)
on Nov 15, 2004 at 19:13 UTC ( [id://407912]=note: print w/replies, xml ) Need Help??


in reply to Re: parse_csv (Cookbook)
in thread parse_csv (Cookbook)

Which is identical behaviour to parse_csv - so it's a good replacement for the other code - which is what powerman set out to do... :-)

Unfortunately even Text::ParseWords seems to have its problems handling CSV... if you have for example:

q<"19"" rackmount",more data>
Instead of converting
"19"" rackmount"
to
19" rackmount
Which is what I understand it should do (try saving it in a CSV file and opening it in excel) It converts it to
19 rackmount
- losing the " altogether :-(

Either we are not using Text::ParseWords the right way, or it can't cope with CSV :-(

Replies are listed 'Best First'.
Re^3: parse_csv (Cookbook)
by demerphq (Chancellor) on Aug 30, 2005 at 12:27 UTC

    Im not sure if its correct to consider Excel-CSV to be "CSV". I personally don't consider them equivelent.

    ---
    $world=~s/war/peace/g

      I certainly wouldn't be one to say that I consider m$ *ANYTHING* to be "where it's at" standard wise, (I guess we can let them have the things that they own (like RTF) and I draw short of saying the things that they "invented" because most of us have read histories of where various m$ branded technologies originated!)

      Unfortunately there is no "official standard" for CSV, which can be a major borker - maybe the different variants should be categorised and numbered like CSV1, CSV2, CSV3 etc so it could be agreed upon as to which variant was being used or referred to... :o)

      Some kind people are (after MANY years of its being around, and at the point where lots of people say it's on the way out (being replaced by XML) trying to fix this problem by defining it...

      I certainly can't speak for all platforms or environments, but one very common format follows the rules that these pages document:

      That was what I was referring to.

      In this case Excel behaves according to those rules, and is thus an easy tool to use to show how CSV data (according to those rules) should be preserved when saved.

        As the author/maintainer of Text::CSV_XS, DBD::CSV and several other CSV-related modules, I've seen quite a few definitions of CSV from users around the world. My definition: a text file that uses commas to separate fields and which can be parsed into fields and records. By this definition, Excel can read CSV but can only write CSV sometimes. :-).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-04-19 11:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found