Chapter 22: Perl


Perl is what is known as a scripting language or an interpreted language. It combines the best features of shell scripting, awk, and sed into one package. Perl is particularly well suited to processing and manipulating text, but can also be used for applications such as network and database programming. Partly because text manipulation is such a common task, Perl has become incredibly popular. It is particularly common for CGI scripting-in fact, the majority of CGI scripts are written in Perl.

Perl was first released in 1987 by Larry Wall. It is open source and can be downloaded for many platforms, including Linux, Solaris, HP-UX, AIX, Microsoft Windows, and Mac OS X. Another reason for the popularity of Perl is the ease with which Perl scripts can be run on different platforms.

The basic syntax of Perl will feel familiar to C/C++ programmers as well as to shell scripters. Unlike many scripting languages, the perl interpreter completely parses each script before executing it. Thus, a Perl program will not abort in the middle of an execution with a syntax error. Perl programs are generally faster and more portable than shell scripts. At the same time, Perl scripts are faster to write and often shorter than comparable C programs.

This chapter is only an introduction to the many uses of Perl. It gives you all the information you need to get started writing your own Perl scripts. However, if you really want to understand Perl, you will need to devote some time to a longer reference. See the section “How to Find Out More” at the end of this chapter for suggested sources.

Obtaining Perl

Most modern UNIX Systems come with perl already installed, usually at /usr/bin/perl. If it is installed on your system, the command perl -v should tell you which version you have. If you do not already have perl installed, or if you want to confirm that you have the latest version, go to http://www.perl.org/. This site, which is a great general resource for Perl information, has links to the various web sites where you can download Perl for your system, including http://www.activestate.com/Products/ActivePerl/. You will also be able to find installation instructions, either on the web site when you download Perl, or included with the Perl distribution.




UNIX. The Complete Reference
UNIX: The Complete Reference, Second Edition (Complete Reference Series)
ISBN: 0072263369
EAN: 2147483647
Year: 2006
Pages: 316

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net