Perl

Home page Models Systems Tools IT staff References

Installing Perl Using

Perl is a very widely used scripting language, especially on Unix systems. Versions are also available for Windows. We use Perl for several of our scripts for running models and post-processing the output. This is the Perl official web site.

Installing Perl

Linux Install Mac Install Windows Install

Linux Install

Perl generally comes installed on Linux by default.

Mac Install

Perl generally comes installed on Macs by default.

Windows Install

Perl doesn't come installed on Windows by default. This isn't a problem as we don't generally use Perl scripts on Windows, since we don't generally do production runs or post-processing of run results on Windows. However, Perl is available on Windows. One Windows implementation is Strawberry Perl.

Using Perl

There is extensive documentation avaible at the official Perl web site. A wealth of information on Perl can be found by using a Google search. It is often helpful to enter Perl error messages into Google. There are also many books on Perl.

Perl has some unique aspects that may require some significant adjustment for programmer's used to other, more conventional languages. Some features of Perl are that variables begin with a "$", "$x++" rather than "x++". Perl has a feature common in many scripting languages called string interpolation. A variable inside a string gets replaced by the variable's value. For example, the following prints "x has the value 3" on the terminal (really on standard output). $x = 3; print "x has the value $x\n"; Perl has native support for arrays and what it calls hashes, which are often called dictionaries or maps in other languages (really hash tables regardless of what a language calls it). Perl arrays and hashes are heterogeneous. A single array can store a mix of items - strings, numbers, arrays or hashes. However arrays and hashes cannot store other arrays or hashes directly, only what Perl calls a reference to an array or hash. The syntax for this can be somewhat unwieldly. Here is a good tutorial on Perl references.