Hi,

I'm looking for a module or a perl code snippet to parse optionally- quoted, comma-separated values.

The most obvious candidate, Text::CSV, won't do the job for two reasons:

-- it only recognizes double-quotes as the quote character. My input uses single-quotes. -- including the quote character within a quoted value requires doubling the literal quote character (i.e. "I said ""Hi"""). My input uses an escape character ('Henry\'s').

I'd like to be able to parse the following example ...

'George',123,'Harry\'s',,'Tuesday, Thursday'

... into five fields:

George
123
Harry's

Tuesday, Thursday

This seems to me to be relatively straightforward Unix-style (unlike what Text::CSV recognizes, which looks to me more like IBM mainframe syntax). Have I overlooked a tool that will do this for me?

Thanks folks..
Chap


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to