Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

How to install Perl on Ubuntu 22.04

- Advertisement -

Hello, friends. In this post, you will learn how to install Perl on Ubuntu 22.04.

What is Perl?

On the language’s website, you will find this definition:

Perl is a highly capable, feature-rich programming language with over 30 years of development.

Yes, despite having 30 years of service, Perl is still making its mark in backend applications and complex configuration scripts. So don’t be surprised that it’s still so popular.

Perl has been modernized and includes a Python-style package manager called CPAN. It also has a fairly large user community, which means that there is documentation everywhere.

On top of this, it is highly flexible, so you can use it for almost any purpose while being fast and secure.

Install Perl on Ubuntu 22.04

The best and fastest way to get Perl on Ubuntu 22.04 is to do it via the distribution’s official repositories. This provides us with a stable and well-integrated version of the system.

So, open a terminal or via SSH connect to the computer. Then, update the whole system completely:

sudo apt update
sudo apt upgrade

Then, as Perl is in the Ubuntu repositories, you just need to run the following command:

sudo apt install perl

In this way, not only the language as such and its interpreter will be installed, but also certain modules that are important for its operation.

At the end of the process, you only have to execute this command to verify the version installed

perl -v

You will get an output like this:

This is perl 5, version 34, subversion 0 (v5.34.0) built for x86_64-linux-gnu-thread-multi
(with 50 registered patches, see perl -V for more detail)

Copyright 1987-2021, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

Test Perl on Ubuntu 22.04

The best way to know if Perl works is to create a file and run it.

So, create a file with extension .pl.

nano hello.pl

And add some code like this

#!/usr/bin/perl
use warnings;
print("Hi, welcome to unixcop\n");
Using Perl on Ubuntu 22.04
Using Perl on Ubuntu 22.04

Save the changes and close the editor.

Now run it with the following command

perl hello.pl

And you should see the output on the screen

Hi, welcome to unixcop

Conclusion

Today you learned about Perl and how to install it on a modern system like Ubuntu 22.04. This is a great step to learn about this language and the possibilities it gives.

- Advertisement -

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook

x