in reply to Text::CSV::Simple parsing issue
Second, I'd concur with the other posters who point out that the data you have can't really be parsed as CSV directly, but needs to be munged first. Your best bet is to get whoever outputs the data to properly escape the embedded quotes by doubling them or putting backslash or some other escape character in front of them. If you can't get that to happen, you'll need to munge the data to put those escapes in first. Whether it's even possible to munge the data with one of the supplied regexen depends on the complexity of your data. For example, it's quite possible to have both commas and quotes embedded in a field so this is a valid CSV record of three fields:
"a",",foo,""bar"",""baz"",","b"If that occurs without the escapes, it will look like this:
"a",",foo,"bar","baz",","b"And I doubt there's a regex that could figure out which commas are separators and which quotes are delimiters from that.
|
|---|