The Perl Tutorial: What's Perl? (1)
Perl is short for Practical Extraction and Report Language. It's a language that is available free over the Web, and it's used for a variety of things, from writing CGI scripts to assisting administrators in maintaining their systems. Perl was created, and is still maintained, by Larry Wall. It's slower than C, but faster than a normal interpreted language. Instead, it's compiled when executed and then interpreted. A Perl compiler does exist but it's still under development. For more information on compiled Perl go to the Perl Home Page.
As I mentioned earlier, one of the nice things about Perl is that it's free. It's distributed under the GNU license, and the source is available from the Perl Home Page. This, along with the fact that it's flexible and has very few constraints, helps make Perl a popular language. It's also highly platform-independent, and has been ported to many different platforms including Unix, Windows, and even DOS. Code modifications can be minor or major depending on any system specific functions that are used.
Perl's popularity has also been encouraged by the fact that you can find support in a variety of places. At the top of the list is the comp.lang.perl/#nlt#/Perl Newsgroup, which is moderated by a number of Perl experts.
Perl and CGI
This is a brief explanation of Perl and CGI. If you have, or want to, put up your own web site, you'll have heard of HTML, Javascript, Java, and CGI. CGI stands for the Common Gateway Interface. CGI is unlike Javascript, HTML, and Client Side Java. CGI provides a standard method for programs written in any language to run on the server side, and to communicate with the Web server software in response to requests for Web pages. In other words, CGI is the part of your web site that communicates with the other programs running on your server.
The main purpose of writing CGI programs or scripts is to afford more interactivity on your web site. Many web sites are static, and don't allow much user interaction. Others have guestbooks, image counters, and allow you to place orders, access databases, and other useful applications.
This is where CGI comes in. In order to implement these types of interactivity, you must have an application running on the server that, for example, knows how to process certain types of user input. As I mentioned, CGI scripts can be written in any language, but the most common are Perl and C. Perl is the preferred language for writing CGI scripts because of its strength in string manipulation. And now other programming languages such as Java and PHP are also gaining popularity, as they provide interactivity without the use of CGI.
CGI programming is nothing more than programming with some special types of input, and a few very strict rules for program output. When a user fills out a FORM (a collection of HTML tags that allow them to submit input) the server sends the form input to the specified CGI program, which in turn parses the entered data and uses it in a specified manner, and returns HTML with an answer to the user's request.
When you're choosing a language in which to write CGI scripts, ensure that the language you select:
Perl satisfies all the above requirements, making it a very good language for CGI programming. If you want to write your own CGI scripts, I'd suggest that you use Perl -- you'll find that it will make your life a lot easier. If you want to get more detail on CGI and how it works, try the CGI specification on the NCSA site (be aware, this is a pretty technical description aimed at experienced programmers).