LPM: parsing

Frank Price fprice at upended.org
Thu Sep 7 12:18:19 CDT 2000


On Tue, Sep 05, 2000 at 10:27:01PM -0400, David Hempy wrote:
> At 09:30 PM 9/5/2000 -0400, you wrote:
> 
> If you need to parse things like the following two lines consisting of 
> three values each...
> 
> Janine,Louisville,"dog, cat",purple
> Dave,Lexington,"dogs, cats, and hairballs",red
> 
> ...you can use Text:CSV.  It will let you specify your own delimiters.  I 
> thing you can change the record delimiter (ie. linefeed) to parse multiline 
> stuff.
> 
> Will that do what you need?

I think so, if my delims are commas.  

I was looking at Text::Balanced last night and it appears closest to
what I want.  It has it's own CPAN entry but comes bundled with
Parse::RecDescent.  I haven't made it work yet but since it's by That
Guru Damian Conway it must be good :-)

BTW, if anyone is interested in a neat little paper by Damian on parsing, a  
reprint from the Perl Journal is online at
http://search.cpan.org/doc/DCONWAY/Parse-RecDescent-1.79/tutorial/tutorial.html

-Frank.
-- 
Frank Price | fprice at upended.org | www.upended.org/fprice/
GPG key: www.upended.org/fprice/gpg.asc | E Pluribus Unix




More information about the Lexington-pm mailing list