in reply to file access

You need to specify you are printing HTML content. The code look like this: open FILE, "<test.txt"; while(<FILE>) {push @lines,$_;} print "Content-type: text/html\n\n"; print "<html>" foreach(reverse @lines){ print "$_\n"; } print "<html>" close FILE;