Jump to content

Your first Perl Program


oneoleguy

Recommended Posts

Hi Everyone,Continuing with my Perl learning process, the first program that is provided in most tutorials and manuals is the simple print statement. Like this:

#!/usr/bin/perlprint "Hello, world";

Well super this works on MS/DOS windows, raw Unix and Linux. I don't know about PerlMac, but I suspect that it does. However, I quickly found that this program won't run on Apache under Linux or Unix Servers. Even when the Apache Server is on your own PC.The reason for this is that you are operating in an Internet/browser environment. You need to modify your program to something like:

#!/usr/perl/bin/print "Content-type: text/html\n\n";print "Hello, world";

The Perl program now prints to your browser in an HTML format.Bill

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...