Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Interpolating a string into list context.

by Somni (Friar)
on Nov 13, 2007 at 07:02 UTC ( [id://650450]=note: print w/replies, xml ) Need Help??


in reply to Interpolating a string into list context.

The simple solution would be to split on comma, then strip quotes on each resulting value. However, I suspect you really want to ignore commas inside quotes, and escaped quotes. This becomes less trivial.

Text::Balanced has some general-purpose parsing routines for extracting quoted text. Regexp::Common has some regexes for matching quoted text, while handling escaped quotes. You would then have to write your own little parser to keep applying the regex.

I realize you asked to do this without the aid of modules. However, the task is much easier with one of these, and for non-trivial cases reinventing your own wheel is not advisable.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://650450]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-03-29 07:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found