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
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 lurking in the Monastery: (6)
As of 2014-12-20 18:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (97 votes), past polls