MajingaZ has asked for the wisdom of the Perl Monks concerning the following question:
# Read File from $INPUT local $/ = undef; my $file = <$INPUT>; # Replace for ", in the file as converting to , " delimiters would cau +se ", to potentially cause parsing problems in the output files $file =~ s/\",/,/g; # Replace tab with "," hard coded for now $file =~ s/\t/\",\"/g; # Inserting " at beginning and end of everyline $file =~ s/\n/\"\n\"/g; # Remove dangling " at eof if $INPUT ends with \n $file =~ s/\"\z//; # Prepend " for first line $file = '"'.$file;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Making CSV Files from Tab Delimited Files
by graff (Chancellor) on Feb 16, 2011 at 03:16 UTC | |
|
Re: Making CSV Files from Tab Delimited Files
by AnomalousMonk (Archbishop) on Feb 15, 2011 at 23:36 UTC | |
|
Re: Making CSV Files from Tab Delimited Files
by CountZero (Bishop) on Feb 16, 2011 at 07:28 UTC | |
|
Re: Making CSV Files from Tab Delimited Files
by Jim (Curate) on Feb 16, 2011 at 00:15 UTC | |
|
Re: Making CSV Files from Tab Delimited Files
by jwkrahn (Abbot) on Feb 15, 2011 at 22:54 UTC | |
|
Re: Making CSV Files from Tab Delimited Files
by wind (Priest) on Feb 15, 2011 at 23:25 UTC |