I am receiving the following server error on a perl script:
malformed header from script. Bad header=: youtube_perl.pl,
Here is my source code:
#!"C:\XAMPP\perl\bin\perl.exe" -T
use strict;
use warnings;
use CGI;
use CGI::Carp qw/fatalsToBrowser/;
use WWW::Mechanize;
my $q = CGI->new;
my $url = 'http://www.youtube.com';
my $mechanize = WWW::Mechanize->new(autocheck => 1);
$mechanize->get($url);
my $page = $mechanize->content();
print $page;
Figured it out. Had to add the following before I attempted to print the page:
print "Content-type: text/html\n\n";
I guess perl can not print html pages without defining the header first.
print "Content-type: text/html\n\n";
Use \n\n
without this it will not print anything it will give:
Malformed header from script error
In your error log file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With