Perl Monk, Perl Meditation | |
PerlMonks |
Re: swapping PIPE for comma in CSV fileby Moron (Curate) |
on Jun 27, 2007 at 10:23 UTC ( [id://623577]=note: print w/replies, xml ) | Need Help?? |
I don't see why you can't just s/\",\"/\"|\"/g - embedded commas won't mess that up - even a single "," field won't mess up because the "," match at separator preceding it will take precedence and s/ will subsequently position after the executed substition at ,",", causing the next match to occur also at the correct place. (Update: Tested it now on "fred",",","bert" and it worked). I am not going to jump on the "always use a module" bandwagon, because only the OPer can possibly know what the issues are surrounding that - I seem to have to keep saying it in here: it is unsafe to draw conclusions when potentially missing crucial information.
__________________________________________________________________________________
^M Free your mind!
In Section
Seekers of Perl Wisdom
|
|