[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] How to parse quoted text?



Hy everyone.

I just started tackling an interesting problem: I have a file that has
information seperated by spaces. Each line is a record. Each item is
enclosed in quotes. For example:

add telecom "856473" "Louis Chretien" "" "Administrator"

you get the idea... ;-)

What would be the best way to parse each item into a separate variable in
Perl? I first tought of split, but split won't account for the quotes
enclosing space (split would seperate between "Louis" and "Chretien")

I thought of using a regular expression, but no pattern is obvious.

Is there a "canonical" way to do this?

any help would be appreciated.

Louis Chretien
lchretien@jdeq.com