in reply to Substituting characters
But it does not guarantee that the output is a valid CSV-file, or at least have the same number of fields in each record as before:use Modern::Perl; while (<DATA>) { tr/"/'/; print; } __DATA__ Dit, is, een, "CSV record" En, dit, "ook", ! En, hij , zei, "'Hallo, hoe gaat het?'"
Dit, is, een, 'CSV record' En, dit, 'ook', ! En, hij , zei, ''Hallo, hoe gaat het?''Far better to use a module like Text::CSV to read in your CSV-file and output it again with this module, but with different delimiters (such as a single quote instead of double quotes).
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Substituting characters
by bart (Canon) on Feb 11, 2012 at 19:06 UTC | |
by CountZero (Bishop) on Feb 11, 2012 at 20:04 UTC |