i am pretty new to perl, and i was trying to set up a web server which runs perl...
i did make it work with another script, but with this one i got this error:
Server error!
The server encountered an internal error and was unable to complete your request.
Error message: End of script output before headers: index.pl
If you think this is a server error, please contact the webmaster.
Error 500
localhost Apache/2.4.9 (Win32) OpenSSL/1.0.1g PHP/5.5.11
This is my script:
#!"C:\xampp\perl\bin\perl.exe"
use strict;
use warnings;
#Open file and define $pcontent as content of body.txt
open(FILE,"body.txt");
local $/;
my $pcontent = <FILE>;
close(FILE)
#Open file and define $ptitle as content of title.txt
open(FILE,"title.txt");
local $/;
my $ptitle = <FILE>;
close(FILE)
#open html code
print "Content-type: text/html\n\n";
print "<html>";
#set html page title
print "<head>";
print "<title>$ptitle</title>";
print "</head>";
print "<body>";
#set the <body> of the html page
if ($pcontent = ""){
print "
<H1>ERROR OCCURED!</h1>"
} else{
print $pcontent;
};
#close the html code
print "</body>";
print "</html>";