"Chap Harrison" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> 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'
> ...

You gave up too quick :-)

Theres also Text::CSV_XS which is configurable (and faster than Text::CSV). 
Specifically, note the quote_char and escape_char arguments to the 
constructor...

Todd W.



-- 
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