Skip to main content
China-Pakistan Economic Corridor

5.3. Perl environment installation

Release time :2026-10-23 21:48:37 UTC

Page Views: 4 views

Before we can start learning the Perl language, we need to install the Perl execution environment.

Perl can run on the following platforms:

  • Unix (Solaris, Linux, FreeBSD, AIX, HP/UX, SunOS, IRIX etc.)

  • Win 9x/NT/2000/

  • WinCE

  • Macintosh (PPC, 68K)

  • Solaris (x86, SPARC)

  • OpenVMS

  • Alpha (7.2 and later)

  • Symbian

  • Debian GNU/kFreeBSD

  • MirOS BSD

  • Wait a minute…

Perl is already installed by default on many system platforms, and we can check whether it is installed by using the following command:

$ perl -v

This is perl 5, version 18, subversion 2 (v5.18.2) built for darwin-thread-multi-2level
(with 2 registered patches, see perl -V for more detail)

Copyright 1987-2013, Larry Wall
……

If you output the above information to indicate that it has been installed, if it is not already installed, you can see the following installation instructions.

5.3.1. Install Perl #

We can download the installation package for the corresponding platform: https://www.perl.org/get.html on Perl’s official website.

Image0

5.3.2. Unix and Linux install Perl #

The steps to install Perl on a Unix/Linux system are as follows:

  • Open it through a browser http://www.perl.org/get.html。

  • Download the source package for Unix/Linux.

  • Download perl-5.x.y.tar.gz to do the following after the file.

$ tar -xzf perl-5.x.y.tar.gz
$ cd perl-5.x.y
$ ./Configure -de
$ make
$ make test
$ make install

Next, if we perl -v command to see if the installation was successful.

After the installation is successful, the installation path of Perl is /usr/local/bin , the library is installed in the /usr/local/lib/perlXX , XX is the version number.

5.3.3. Window install Perl #

Perl has ActiveStatePerl and Strawberry Perl compilers on the Window platform.

The biggest difference between ActiveState Perl and Strawberry Perl is that Strawberry Perl contains more than some modules in CPAN, so the installationfiles downloaded by Strawberry Perl are more than 80m, while ActiveState Perl is only about 20m.

We use Strawberry Perl here.

The steps to install Perl on a Window system are as follows:

  • Link to the Strawberry installation package: http://strawberryperl.com .

  • Download the version of your system: 32bit or 64bit.

  • After downloading, double-click to open it, and press the installation wizard to install it step by step.

Image1

5.3.4. Mac OS install Perl #

Mac OS systems generally have Perl installed by default. If not, perform thefollowing steps:

$ tar -xzf perl-5.x.y.tar.gz
$ cd perl-5.x.y
$ ./Configure -de
$ make
$ make test
$ make install

After successful execution, the installation path of Perl is /usr/local/bin , the library is installed in the /usr/local/lib/perlXX , XX is the version number.

5.3.5. Run Perl #

Perl can be executed in different ways.

5.3.6. 1.Interactive #

We can execute the perl code directly from the command line. The syntax format is as follows:

$perl  -e            # Unix/Linux

or

C:>perl -e           # Windows/DOS

The command line parameters are as follows:

Option

Description

-d[:debugger]

Run the program in debug mode

-Idirectory

Specify the @ INC/#include directory

-T

Allow pollution detection

-t

Allow pollution warning

-U

Allow unsafe operations

-w

Allow a lot of useful warnings

-W

Allow all warnings

-X

Disable use warning

-e program

Execute perl code

file

Execute perl script file

5.3.7. 2.Script execution #

We can put the perl code in a script file and execute the file code with thefollowing command:

$perl  script.pl          # Unix/Linux

or

C:>perl script.pl         # Windows/DOS

5.3.8. IDE:Integrated Development Environment #

We can also execute perl scripts on some graphical user interface (GUI) environments. The following two common Perl integrated development environments are recommended:

  • Padre Padre is an integrated development environment for Perl language developers, providing syntax highlighting and code refactoring.

  • EPIC EPIC is a plug-in for Perl Eclipse IDE. If you are familiar with Eclipse, you can use it.

    Installation steps: Help– > Eclipse Marketplace– > enter EPIC– > Select install and update.

Image2