How to install Perl on Ubuntu 18.04/19.10

Perl is commonly referred to as ā€œPractical Extraction and Reporting Languageā€. It is open-source and free software thus no worry of money while using Perl. It runs on most operating systems and can be easily migrated to different operating systems.

From the beginning, Perl was designed to simplify simple work without losing the ability to handle difficult problems. It makes it easy to manipulate numbers, text, files and directories, computers and networks, especially the language of programs. Perl was originally designed as a Unix scripting language, but it has long been ported to most other operating systems. Because Perl can be run almost anywhere, Perl can be said to be the most portable programming environment today to write portable C/C++ programs.

Here in this tutorial, we will know how to install it on Ubuntu Linux operating systems such as Ubuntu 16.04/18.04/18.10/19.04 including Linux Mint.

  1. Open Ubuntu Command Terminal to install Perl latest stable version. For that, you can use Keyboard shortcut Ctrl+Alt+T.
  2. Either log in as root or your current Ubuntu user should have access of sudo.
  3. Run system update command to get the latest version of already installed packages.
    sudo apt update
  4. Perl comes in the default repository of Ubuntu, thus no need to add any third-party repo.
  5. Run the Perl installation command:
    sudo apt-get install perl
  6. Check installed Perl version.
    perl -v
  7. In our case, it was Perl v5.26.check installed perl version
  8. Now, if you want to install Perl modules, which are set of codes used in carrying out or run some certain programs based on Perl. Thus, you can use CPAN (Comprehensive Perl Archive Network) it features a wide range of Perl modules and same can be installed for Perl using its commands.
  9. The below command will install cpanminus which is basically a script used to install modules for Perl from CPAN and it performs unpacking and building of the same. Here is the command to Install App-cpanminus Perl module.
    cpan App::cpanminus

    Install cpan on Ubuntu for Perl

  10. After the installation of CPANā€™s cpanminus, if you want to install any Perl module, run cpan install moudle-name command. For example, if we want to install Gtk2 module, then simply run:
    sudo cpan install YAML
  11. In this way, we can install Perl and its modules on Ubuntu Linux or its based operating systems.