Perl Script Installation


If you are used to using Perl scripts then don't bother reading the rest of this page, it just describes how to install and run a command line Perl script for people who are used to programs coming with an automatic installer and run by clicking on an icon.

System Requirements

Of course, it needs your computer to have a Perl interpreter installed. If you use a Unix type operating system then there is probably one already installed by default. If you use Microsoft Win32 then the Active State version of Perl is an easy one to use. If you use Mac OS version <= 9 then Mac Perl is available but not very easy to use. Mac OS version >= 10 is a Unix.

If you need to install Active State Perl or Mac Perl, just download the appropriate binary version and follow the installation instructions which come with it. (The reason for using a 'binary' version is that that is already compiled from the C source code the Perl interpreter is itself written in. The alternative, compiling the C source code yourself, is a problem on Microsoft Windows & Macintoshes because, unlike Unix, they don't come with a C compiler included as standard.)

How to Install a Perl Script

There is nothing special in installing a Perl program/script. Normally, it is just copying the file to your computer.

The only extra needed is if you want to avoid having to type 'perl ' every time when running it:

If you don't mind typing 'perl ' infront of its name each time you run it:
Nothing else needed. It is ready to run.
If your computer recognises Perl programs from the '*.pl' file name:
Nothing else needed. It is ready to run.
If you want to run it from a command line without the 'perl ' addition, and your computer, like Unix, recognises Perl programs from their first line rather than the file name:
All it needs extra is for you to open the program in a text editor and change the the file path after the '#! ' characters on the first line to the file path of the Perl interpreter on your computer.

Linebreak Conversion

One slight complication in this is that the program comes as an ASCII text file and Unix, Mac OS & Microsoft Win/DOS awkwardly use different ASCII character codes for line breaks in text files (line-feed, carriage-return & carriage-return plus line-feed characters respectively), you might need to run convert the line break format.

There is almost certainly some program on your computer already which can perform this common task but, if not, the appropriate one of the following three Perl scripts should do the job of converting any of the three formats to the named one. I converted them to the different formats before uploading to the web server so they won't need converting themselves.

How to Run a Perl Script

Run the script/program from a command window. In Unix (including Mac OS >= 10) this is terminal window and in Microsoft Windows it is a console window (sometimes called an MS DOS window but this not literally correct in Windows NT where it is more of a MS DOS emulator as the Windows NT3.51/NT4/2k/XP series does not have MS DOS underneath like the Windows 3.11/95/98/ME series).

The command to run a Perl script in the Perl interpreter is 'perl ' followed by the name of the program/script file followed by its parameters. If you have set up your computer to recognise Perl scripts (from the '*.pl' file name or the '#! ' line) then you can omit typing 'perl ' if you like as it should automatically use the Perl interpreter for it. That is assuming it is in the current directory, if not then just include route to the directory it is in as well.

If your Perl interpreter installation recognises Perl scripts so they can be run by double-clicking (or similar) on their file icons in a graphical user interface then that is an alternative possibility but it is a bit cumbersome passing the parameters that way.

What is the Difference between a Perl 'Script' & Perl 'Program'?


The terms 'scripts', 'programs' & 'applications' are used interchangeably. Typically programmers use the term 'script' for one that is interpreted (i.e. stays as source code and is an 'interpreter' tells the computer hardware to performs the actions required) and 'program' for one that is compiled (i.e. converted by a 'compiler' into commands the computer hardware understands directly). The name 'script' come from the fact that an interpreted program still looks like text when it received. The name 'program' comes from the generic description of what computer scripts & programs really are: a set on intructions which tell a computer what to do in what order, i.e. a programme to follow. However, there are many cases where what happens is partly interpretation & partly compilation and some languages have both options so the distinction between 'scripts' & 'programs' is normally irrelevant. The term 'application' is typically used for people who don't understand how computers work and just consider a program/script to be something made by someone else which does something.

All three terms have other (the original) meanings in English and so are ambiguous. Ideally a new word should have been invented for this new concept but, like so much computer nomenclature, an existing word was confusing given an extra meaning.