Jump to content

Your first Perl Program

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

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now