In both perl and python, you have to print some headers (if you want) and a new line before the page content. Otherwise you get an error - End of script output before headers.
In php things are different. Whenever you print something (using either print "" or echo ""), it is assumed as a plain text, even if you try to print a header. To do this (print a header), you should use the header() function (which is not available in perl and python).
Some examples:
<?php
# this is a plain text in the page, you can use 'echo ""' to get the same result
print "Content-type: text/plain; charset=utf-8\n\n";
#!usr/bin/perl
# this is a header with two new lines after it (without them you get the error)
print "Content-type: text/plain; charset=utf-8\n\n";
# (the same is in python)
<?php
print "Some text, no headers are sent, no new lines are printed and you get no errors";
#!usr/bin/perl
print "Some text, no headers are sent, no new lines are printed and you get an error.";
# (the same is in python)
You have to place a new line before text in perl in python but not in php. The same code in similar languages has such a different result?
Why in perl and python you print() the headers but in php you header() them?
Why in php you don't have to print new line to say "end of headers"?
printin php means that user wants to output html/text and not headers which are implicit in such scenario.