use strict; use warnings; use English; $OUTPUT_RECORD_SEPARATOR = "\n"; # Open files my $csv_filename = shift; open my $csv_fh, "<", $csv_filename or die "Cannot open $csv_filename file: ", $OS_ERROR; open my $html_fh, '>', 'gen_try.html' or die "Cannot open gen_try.html file: ", $OS_ERROR; # Print Heading html using heredoc print {$html_fh} < CSV Output EOHTML # Read CSV file while ( my $line = <$csv_fh> ) { chomp $line; # Only for html readability my @fields = split /,/, $line; print {$html_fh} ( '', ( map {qq{}} @fields ), '' ) or die "Cannot print to html file: ", $OS_ERROR; } print {$html_fh} < EOHTML close $csv_fh or die "Cannot close $csv_filename file: ", $OS_ERROR; close $html_fh or die "Cannot close output file: ", $OS_ERROR; __END__
$csv_filename
$_