Who knows if anyone else but me will ever find this useful, but, hey, if you do, knock yourself out.
No guarantees this does anything right. Licensed under whatever the latest GPL is whenever you read this.
#!/usr/bin/perl
use Text::CSV;
use strict;
# CSV parse object
my $csv = Text::CSV->new ({
binary => 1,
auto_diag => 1,
sep_char => ',' # not really needed as this is the default
});
my $file = $ARGV[0] or die "No CSV file specified\n"; # Path to CSV file
open(my $data, "<", $file) or die "Could not open '$file' $!\n"; # Open file
print "[table]\n";
# Read file in line by line.
while (my $line = <$data>)
{
print "[tr]";
chomp $line;
if ($csv->parse($line))
{
my @fields = $csv->fields();
foreach(@fields)
{
print "[td]";
print $_;
print "[/td]";
}
}
print "[/tr]\n";
}
print "[/table]\n";