mkHun mkHun - 8 months ago 25
Perl Question

Why use `\n` in CGI script while printing header?

In CGI script, on the top the program we use the:

print "Content-type: text/html\n\n";
without using
it will not execute. But, inside the HTML body, we do not use
can't make any sense, for new line we use

is necessary in the header line?


Content-type: text/html is the HTTP header, not HTML. For detecting the end of HTTP header must be one empty line. First \n for end of current line, second \n for new empty line.