Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Interpolating a string into list context.

by Somni (Friar)
on Nov 13, 2007 at 07:02 UTC ( #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.

  • Comment on Re: Interpolating a string into list context.

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2023-11-29 12:42 GMT
Find Nodes?
    Voting Booth?

    No recent polls found