in reply to parse_csv (Cookbook)

Fine... except that stuff like "19"" rackmount" will be parsed as 2 fields, not 1.
--
TTFN, FNORD

xaphod

Replies are listed 'Best First'.
Re^2: parse_csv (Cookbook)
by serf (Chaplain) on Nov 15, 2004 at 19:13 UTC
    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 :-(

      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.