in reply to Re: Re: csv to flat-file
in thread csv to flat-file
OK. In the substitution replace the comma witha newline character: s/,/\n/g;
The split solution could become:
$, = "\n"; print split(',',$line);
($, = "\n"; sets the character used to separate entries when print is used to print an array, as returned by split)
As pointed out, all these solutions fail if any entries can contain a comma, in which case you should investigate the modules suggested elsewhere. I was assuming that since the format of your example was simple you would not have such complex data.
|
|---|