Known as much for its confusing, often oddball, syntax as for itsefficiency and speed, Perl has a mystique that very few languages canmatch. This first article in a new series gives novice and intermediateprogrammers an introduction to the basics of the language.
Perl is a very popular language for server-side scripting primarily because of its close relationship with the UNIX platform. Most Web servers run UNIX or one of its variants, and Perl is available on most or all of these systems. The language is so powerful that many routine administration tasks on such systems can be carried out in it, and its superior pattern-matching techniques come in very useful for scanning large amounts of data quickly.
Geeks will be happy to hear Perl is an interpreted language. Why is this good? Well, one advantage of an interpreted language is that it allows you to perform incremental, iterative development and testing without going through a create/modify-compile-test-debug cycle each time you change your code. This can speed the development cycle drastically. And programming in Perl is relatively easy [famous last words!], especially if you have experience in C or its clones. Perl can even access C libraries and take advantage of program code written for this language, and the language is renowned for the tremendous flexibility it allows programmers in accomplishing specific tasks.
And then of course, there's cost and availability - Perl is available free of charge on the Internet, for the UNIX, Windows and Macintosh platforms. Source code and pre-compiled binaries can be obtained from http://www.perl.com/, together with installation instructions. The examples in this series of tutorials will assume Perl 5.x on Linux, although you're free to use it on the platform of your choice.
If you're on a UNIX system, a quick way to check whether Perl is already present on the system is with the UNIX "which" command. Try typing this in your UNIX shell:
$ which perl
If Perl is available, the program should return the full path
to the Perl binary, usually
Or if you're really lazy, you could just ask your system
On any other platform, try checking your PATH environment variable for a directory containing the Perl executable.