in reply to csv'ish string with parens that include commas
I would preprocess with
Seems to workmy $csv = Text::CSV->new({ qw! allow_loose_escapes 1 allow_loose_quotes 1 ! }); ... s/x\(([^\(\)]+)\)/"$1"/g; $csv->parse($_);
$ perl -MText::CSV -e" $t = Text::CSV->new({qw! auto_diag 1 allow_loos +e_escapes 1 allow_loose_quotes 1 ! }); $_ = q!sue,fred,x(mary,jane)!; + s/x\(([^\(\)]+)\)/\x22$1\x22/g; warn $_; warn $t->parse( $_ ); warn$ +_ for $t->fields" sue,fred,"mary,jane" at -e line 1. 1 at -e line 1. sue at -e line 1. fred at -e line 1. mary,jane at -e line 1.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: csv with parens that include commas
by ascetic (Novice) on Dec 05, 2010 at 01:37 UTC | |
by Anonymous Monk on Dec 05, 2010 at 02:28 UTC | |
|