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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...