use strict; use warnings; use Text::CSV; my $csvFile = 'irregular-verbs.csv'; my $outFile = 'new.htm'; open my $outFH, '>', $outFile or die "Cannot open $outFile: $!"; my $csv = Text::CSV_XS->new( { binary => 1, auto_diag => 2 } ) or die "Cannot use CSV: " . Text::CSV->error_diag(); open my $csvFH, '<', $csvFile or die "Cannot open $csvFile: $!"; # $row contains an array reference to the parsed csv line's data while ( my $row = $csv->getline($csvFH) ) { print $outFH ''; print $outFH "$_" for @$row; print $outFH "\n"; } close $csvFH; close $outFH;