in reply to csv output
The rules are about: The columns are separated with a special char; if this char is inside a column, then the column is embraced by "" (or sometimes '').
my $csvSep = ','; # comma as csv-separator foreach my $line (@rows){ # e.g. 2-dim array my @columns = @$line; print join($csvSep, # join by $csvSep map { /\Q$csvSep/ ? "\"$_\"" : $_ # if $csvSep found in Value: "val" } @columns; # take columns ), "\n"; # and a newline... } # foreach
Best regards,
perl -le "s==*F=e=>y~\*martinF~stronat~=>s~[^\w]~~g=>chop,print"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 2: csv output
by tilly (Archbishop) on Mar 14, 2002 at 19:10 UTC |