B.4 Downloading

Following are some directions for getting Perl to work on your Unix or Linux, Macintosh, and Windows computers. (It is also available for several other less common operating systems from the Perl web site.)

There is one web site that serves as a central jumping off point for all things Perl: http://www.perl.com. This web page has a Downloads clickable button that guides you to everything you need to install Perl on your computer.

The more specific directions that follow are up-to-date as of this writing, but you should be aware that the web pages they refer to may change their design. So, basically, go to http://www.perl.com, and look for the Downloads link to click on. The system should tell you everything you need to know after that. There will be a HELP link and other helpful links besides. So even if the information in this section becomes outdated, you will certainly be able to visit the main Perl web site and find all you need to install Perl.

Downloading and installing Perl is usually quite easy; in fact, the majority of the time it's perfectly painless, but sometimes you may have to put some effort into getting it to work. If you're new at programming, and you run into difficulties, the best thing to do is to ask for help from someone who is a professional computer programmer and/or administrator, teacher, or someone in the lab who already programs in Perl. But the chances are that you won't need any help: keep reading!

B.4.1 Binary Versus Source Code

One choice you will find when downloading is the choice between binary or source code distributions of Perl. The chances are very good that a binary version will be available for your computer. Get that if it's available for your particular system.

Recall that a binary (or executable or compiled program) is a program that has been translated into machine language and is ready to run. Source code is a program written in a language such as C or Perl, which can then be compiled or interpreted to become a binary. The Perl application is actually written in the C programming language, so it's also possible to get the C source code for the Perl application and compile it to create the Perl application binary.

The best choice for installing Perl on your computer is usually to get an already made binary version of the program, because nothing else needs to be done. However, if no binary is available, or if you want to control the various options of your Perl installation, you can get the source code for Perl, which is itself written in the C programming language. You then compile it using a C compiler. But I repeat: see if you can find a binary for your particular computer operating system; compiling from source code is more complicated for beginners! Details are available at the Perl web site.

B.4.2 Perl for Unix and Linux

Recall that Unix and Linux are essentially the same kind of operating system?Linux is a clone of Unix. Both Unix and Linux come in several variants offered by various companies.

Perl was originally developed on Unix and for quite some time now it has come already installed on most such systems. Open a window and type perl -v. If you get version information, Perl is there.

If Perl isn't installed on your Unix or Linux machine, first try to find a binary to install. Go to the Downloads page of http://www.perl.com. You'll see the subheading Binary Distributions. Select Unix or Linux, and then see if your particular flavor of system has a binary available. Several versions of Unix and Linux are available here, and the instructions available at the web site should be enough for you to get Perl installed once you've downloaded the binary. Most versions of Linux maintain up-to-date Perl binaries on their web sites. For instance, if you have a Redhat Linux system, you need to identify which version of the system you have (by typing uname -a); then get the appropriate rpm file to download and install. Redhat has an rpm for Perl that Redhat Linux users can install by typing:

 rpm -Uvh perl.rpm

Note that the actual name of the perl.rpm file varies.

If no binary version of Perl is available for your flavor of Unix or Linux, it is necessary to compile Perl from its source code. In this case, starting from the main web page http://www.perl.com, you click on the Downloads button and then select Source Code Distribution. The source code has an INSTALL file that has instructions that will guide you through downloading the source code, installing it on your system, compiling the source code into a binary, and finally installing the binary.

Compiling from source code is a considerably more lengthy process than installing an already made binary and requires a bit more reading of instructions, but it usually works quite well. Occasionally, however, a problem does arise, and if you are a beginner, I strongly suggest that you search out an experienced programmer or system administrator who knows Unix, Linux, or Perl, as it's an easy task for the experienced, but can be a bit confusing the first time around for the beginner. You need a C compiler on your computer to install Perl from the source code. Nowadays, some Unix systems ship without a complete C compiler! Linux will always have the free C compiler called gcc installed, and you can also install gcc on any Unix (or Windows, or Mac) system that lacks a C compiler.

B.4.3 Perl for Macintosh

The MacOS X is a Unix-based system. It ships with Perl installed. But you may be able to find more recent versions by looking at the Downloads page, then at Binary Distributions, then at Unix or Linux, and go to the Mac OS X link.

MacPerl is a port of Perl to pre-OS X Macintosh operating systems. The MacPerl installation steps are clearly explained on the MacPerl web page, http://www.macperl.com (which you can also find from the Perl web page http://www.perl.com and its Downloads button). I'll give a brief overview of the process here.

From the MacPerl page, click on Get MacPerl, and follow the directions to download the application. It will appear on your desktop. Double-click it to unstuff it. If you don't have Alladin Stuffit Expander (most Macs already do) this won't work, and you'll first have to go to http://www.alladinsys.com to download and install Stuffit.

MacPerl can be installed as a standalone application under the Mac OS Finder or as a tool under the Macintosh Programmer's Workbench; most users will want the standalone application. Perl Version 5 is available for Mac OS 7.0 and later. More details about which Perl version is available for your particular hardware and Mac OS version are available at the MacPerl web page.

B.4.4 Perl for Windows

Several binaries for different Windows versions are available. Since Windows is closely coupled with Intel 32-bit chips, these binaries are often called Wintel or Win32 binaries. The standard Perl distribution now is ActivePerl from ActiveState, at the web address http://www.activestate.com/ActivePerl/ and the complete installation directions are there on the web page. You can also get to that web page via the Downloads button from the Perl web site http://www.perl.com. You'll then see the subheading Binary Distributions. Under that, click on Win32. Then, click on the ActivePerl site.

From the ActiveState web site's ActivePerl page, click the Downloads button. Then you can download the Windows-Intel binary. Note that installing it requires a program called Windows Installer which is available at that same web page if it's not already on your computer.