Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

browser page is showing empty

hello world program



6:21 am on Dec 3, 2008 (gmt 0)

5+ Year Member


I am very new to CGI/PERL.I tried to run the hello world program but my browser is showing the page empty.

I changed the permission also to 755.

print "Content-Type: text/plain", "\n\n";
print "Hello World in Perl", "\n";


11:41 am on Dec 3, 2008 (gmt 0)

10+ Year Member


Not sure your content-type line is correct, not seen it done like that before, try this:

print "Content-type: text/plain\n\n";
print "Hello World in Perl", "\n";

Or it should be this if your going to be outputting HTML:
print "Content-type: text/html\n\n";
print "Hello World in Perl", "\n";


2:14 pm on Dec 3, 2008 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Perl prints comma -separated lines as well as full double quoted lines. Although you'd most often use text/html as your content-type, text/plain should also be fine.

my browser is showing the page empty.

There is nothing wrong with your script "as presented" so my guess is there are only two possible problems, and they are working in combination.

1. Path to perl might be wrong. #!/usr/bin/perl is standard, but some servers might need #!/usr/local/bin/perl or other path (rare, but possible.)

2. Generally, if the above condition is true, you *should* get a 500 Internal Server error. However, the white page tells me there is something astray with your server configuration that is not correctly handling CGI errors, hence, the white page. I have seen this and it makes scripts really hard to debug (given that they are working offline.)

A corollary possibility is that your server is just not executing your code. If CGI and perl support were not enabled, it would just display the script as a plain text file, so it's not that.

Are you executing this script in an area the server allows script execution? Example, many servers will only allow script execution from the cgi-bin. Try to run the script in the domain root and it will error, print the script as plain text, or . . . give you a white page. :-)

These should give you enough into to start figuring it out.


8:18 pm on Dec 3, 2008 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

you could always try checking the server logs for clues.

Featured Threads

Hot Threads This Week

Hot Threads This Month