Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Re: Re: Splitting a comma-delimited string where a substring could countain commas

by mrbbking (Hermit)
on May 05, 2002 at 00:39 UTC ( #164080=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Splitting a comma-delimited string where a substring could countain commas
in thread Splitting a comma-delimited string where a substring could contain commas

If the whole field were in parenthesis, you're right, that would work.

But the value is this:
, these (not enough, nope, never),
...not this...
, (these not enough, nope, never),

Text::CSV_XS chokes if you replace the parens with your tr/// suggestion. CSV requires that either the whole field or none of the field be quoted - you can't quote part of a field.


Comment on Re: Re: Re: Splitting a comma-delimited string where a substring could countain commas
Replies are listed 'Best First'.
Re4: Splitting a comma-delimited string where a substring could countain commas
by belg4mit (Prior) on May 05, 2002 at 01:18 UTC
    Good call. A little massaging would overcome that, but then that puts us in the realm of s/// and others have already posted better solutions using that.

    --
    perl -pew "s/\b;([mnst])/'$1/g"

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (19)
As of 2015-07-31 14:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (278 votes), past polls