Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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 ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://164080]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2024-04-18 14:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found