I am trying to open and read a textfile and then write the content of this file line per line into an HTML-File. So far, I've come up with this:
use strict;
use locale;
my (@datei, $i);
open (FHIN,"HSS_D.txt") || die "couldn't open file $!";
@datei= <in>;
close FHIN;
open (FHOUT, ">pz2.html");
print FHOUT "<HTML>\n";
print FHOUT "<HEAD>\n";
print FHOUT "<TITLE>pz 2</TITLE>\n";
print FHOUT '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">';
print FHOUT "\n</HEAD>\n";
print FHOUT "<BODY>\n";
for ($i = 0; $i < @datei; $i++) {
print FHOUT "<p>$datei[$i]</p>\n";
}
print FHOUT "</BODY></html>\n";
close (FHOUT);
However, I get a compilation error every time and I can't figure out what's wrong. Thanks for your help!