In perl, while executing the program, getting malformed header from script. How to fix it?

Output file type setting might be missing try this

print "Content-type: text/html\n\n";

or if you have any print statement before sending Content-type then that also cause this error.