#!/usr/bin/perl
use warnings;
use strict;
my $lineNum=1;
print "
\n";
if ( -f $ARGV[0] ){
#$ARGV[0] is a file
open(CSV,'<',$ARGV[0]);
while (){
csvLine2Html($_);
}
close(CSV);
} else {
#TODO...
#$ARGV[0] is not a file
}
print "
\n";
sub csvLine2Html{
my $line = shift;
chomp($line);
if ($lineNum == 1){
#first line contains header information
print "\t\n";
print map{ "\t\t| $_ | \n" } split /,/, $line;
print "\t
\n";
} else {
print "\t\n";
print map{ "\t\t| $_ | \n" } split /,/, $line;
print "\t
\n";
}
$lineNum++;
}