my $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_loose_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.