Installing Perl (for the impatient)
This guide should cover the majority of situations where we want to "just install it" and get started programming.
Installing Perl on Windows
Windows users can download an installer for perl 5.10.1 from http://strawberryperl.com/. Simply download and run the installer. Then, close your Command Prompt terminal and re-launch cmd from Start -> Run to get a command-line shell with the newly-defined environment. If running the command
perl --version still gives you an error message you probably need to add an entry to your
PATH environment variable (run the command
echo %PATH% to verify this.) Right-click on My Computer and select "Properties", then click on the "Advanced" tab and select "Environment Variables". Under your User variables, click "New", and create a variable named
Path with the value
C:\strawberry\perl\bin. Now, relaunch cmd again to get the newly-defined environment and you should get the desired answer from
perl --version. (If all else fails, you can type the full path
C:\strawberry\perl\bin\perl to run perl.)
Installing Perl on a Unix-like OS
For OS X and Linux users, building from source is simple enough once you have the necessary build tools installed. Apple offers a free download of their 'xtools', which includes a compiler and full set of tools (this may also be on a second disk which came with your computer.) Debian and Ubuntu have a package called 'build-essential' for this. In any case, your computer needs 'gcc', 'make', and various other components to be able to build perl from source.
Download the perl source code from http://www.cpan.org/src/perl-5.10.1.tar.gz, save it in your home directory (which should be your current working directory), then unpack and build it with the shell commands below.
tar -xzf perl-5.10.1.tar.gz cd perl-5.10.1 ./Configure -des -Dprefix=/usr/local make make test sudo make install
Now you have installed perl as
/usr/local/bin/perl, which should become the first perl in your
$PATH. Make sure you get the desired answer from
You may not have the necessary permissions to install into
/usr/local. In such a case, configure with the appropriate prefix and set
$PATH accordingly (e.g.
PATH=$HOME/perl/:$PATH) or use an absolute filename to call perl. The following would install your new perl under
~/perl/ and the perl executable would be
tar -xzf perl-5.10.1.tar.gz cd perl-5.10.1 ./Configure -des -Dprefix=$HOME/perl make make test make install