Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Re (tilly) 1: parsing CSV file with embedded commas (fortunately, fixed-width) - is unpack the solution?

by amelinda (Friar)
on Nov 01, 2001 at 03:39 UTC ( #122454=note: print w/replies, xml ) Need Help??


in reply to Re (tilly) 1: parsing CSV file with embedded commas (fortunately, fixed-width) - is unpack the solution?
in thread parsing CSV file with embedded commas (fortunately, fixed-width) - is unpack the solution?

Actually, I'm more interested in how it could handle the unescaped embedded comma in one of the fields.

If only splitting (or Text::xSVing) would handle that extraneous comma, i could worry about stripping off the quote marks later. It was the combination the unescaped embedded comma, the unescaped embedded quote, and the fact that only some fields were marked off in quotes that led me down the road to unpack.

  • Comment on Re: Re (tilly) 1: parsing CSV file with embedded commas (fortunately, fixed-width) - is unpack the solution?

Replies are listed 'Best First'.
(tye)Re6: parsing CSV file with embedded commas (fortunately, fixed-width) - is unpack the solution?
by tye (Sage) on Nov 01, 2001 at 04:25 UTC

    Embedded commas aren't a problem for CSV. The whole point of putting quotes around fields in the CSV is so that embedded commas can be dealt with. Embedded quotes aren't a problem if they are escaped (by doubling them).

    If you are curious how this is done, then I encourage you to download Text::CSV and/or Text::xSV (or just look at Text::xSV locally) and look for yourself. (:

            - tye (but my friends call me "Tye")

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2020-10-22 03:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (225 votes). Check out past polls.

    Notices?