more useful options | |
PerlMonks |
Re: Converting File Delimitersby kcott (Archbishop) |
on Aug 09, 2012 at 00:24 UTC ( [id://986392]=note: print w/replies, xml ) | Need Help?? |
Text::CSV can help in parsing the quoted fields with commas. Quoting the fields containing commas in the original data stops those commas from being interpreted as separator characters. Changing the separator to a pipe character (|) removes that requirement. Consider whether |ccc, ddd| is sufficient for your needs or do you really want |"ccc, ddd"|. If the former, this skeleton code shows the technique:
Output:
If you want to retain the quotation marks, you can change the print line to:
(There may be a more elegant way to do that.) Output:
-- Ken
In Section
Seekers of Perl Wisdom
|
|