Perl 101 | WebReference

Perl 101

Perl 101

How to install a basic Perl script on a Web server

By Scott Phillips ([email protected])

One of the first things I learned when I began to write HTML is that it is relatively simple to create a Web site. I have always thought that, given the time and resources, I could train a monkey of average intelligence to design a simple Web site. However, what HTML lacks is the ability to enable true interactivity on a Web server. In order to make a site dynamic, enabling it to accomplish "real" tasks, a more advanced scripting language and protocol must be used. That is the beauty of Perl and the reason it has become one of the more if not, the most popular languages on the Web.

Perl, which stands for Practical Extraction and Report Language, is an extremely portable language written to assist the programmer with common tasks with an emphasis on text manipulation. Perl is different from CGI. While Perl is a scripting language, CGI (Common Gateway Interface) is a protocol. CGI describes a process in which a client or an external program interacts with a Web server. A CGI program dictates and facilitates this interaction, or the passing of information back and forth. The majority of CGI programs are written in Perl, which explains Perl’s popularity, but they can be written in just about any language.

Assumptions & Requirements

Before I delve too far into the process, I have made two assumptions. The first and most important assumption is that you have access to a server with a version (preferably the latest) of Perl installed. Second, I have to assume that you are comfortable downloading and installing software on your computer.

There are four critical ingredients to installing a Perl program: a text editor, an FTP program, a server, and a Perl script. Although virtually any text editor will do, the more code you write, the more comfortable you will want to be with your program. Personally, I recommend Super NoteTab or TextPad for the Windows platform, although your systems Notepad will suffice. For MacOS users you also have several options, from Mactext to BBEdit. Whichever program you decide to use--no matter which platform you are on--you will want to make sure that you have word wrap disabled. There are probably as many FTP programs available as there are Text editors. For windows, CuteFTP (my favorite) or WSFTP will get the job done, and for the Mac nothing can match the functionality of Fetch. The last ingredient is a simple Perl program. Although the program we are going to work with in this article is relatively simple in what it accomplishes, it will help to illustrate some key points you will need to consider when working with Perl.

Comments are welcome


Revised: May 8, 1998

URL: https://webreference.com/programming/perl/101/