This is an adaptation of a CGI I wrote for a client, basicly
it just parse's a csv file from stdin and outputs table code.
Just thought someone might like or learn from it
#!/usr/bin/perl -w use strict; use Text::CSV_XS; my($csv) = Text::CSV_XS->new; my($c) = 0; my(%options,@em); $options{TABLE} = ""; $options{TH} = ""; $options{TD} = ""; $options{TR} = ""; if ($ARGV[0] eq "--help") { print <<END_HELP; Available Options: TABLE="<options>" TH="<options>" TD="<options>" TR="<options>" Examble Usage: cat test.csv | ./csvtotable.pl TABLE="border=1" > output END_HELP @em = <STDIN>; exit(0); } map { if (/^(\w+)=(.*)$/) { $options{$1} = $2; } } @ARGV; while(<STDIN>) { if ($c==0) { print "<table $options{TABLE}>\n"; $csv->parse($_); map { print "<th $options{TH}>$_</th>\n"; } $csv->fields(); } else { $csv->parse($_); print "<tr $options{TR}>\n"; map { print "\t<td $options{TD}>$_</td>\n"; } $csv->fields(); print "</tr>\n"; } $c++; } print "</table>\n";