What is Perl?

Perl is a general purpose language for getting things done, especially in text processing. Created by Larry Wall, the Perl language is managed by The Perl Foundation. For the latest language news and versions, check out Perl.org.

To setup required environment variables for Perl with base modules, please use following command:

System Version Command
HPC2021 5.34.0 module load perl/5.34.0

Managing additional Perl modules

The environment module above only contains the base Perl modules and user may install additional Perl module using the following environment module.

System Version Command
HPC2021 5.34.0 module load perl-lib/5.34.0

CPAN Minus is a light-weight replacement for CPAN. In order to install your own Perl modules, you can use the CPAN Minus tool (cpanm).

For example, a user may run the following to install the “JSON” Perl module described at https://metacpan.org/pod/JSON to a local Perl libary folder (i.e ~/perl/lib/5.34.0, please create it with “mkdir -p ~/perl/lib/5.34.0” if it is not present)

Install Perl Module

$ module load perl/5.34.0 perl-lib/5.34.0
$ cpanm install JSON
install is up to date. (0.01)
--> Working on JSON
Fetching http://www.cpan.org/authors/id/I/IS/ISHIGAKI/JSON-4.03.tar.gz ... OK
Configuring JSON-4.03 ... OK
Building and testing JSON-4.03 ... OK
Successfully installed JSON-4.03
1 distribution installed

Uninstall Perl Module

$ module load perl/5.34.0 perl-lib/5.34.0
$ cpanm --uninstall JSON
JSON contains the following files:

  /home/$USER/perl/lib/5.34.0/lib/perl5/JSON.pm
  /home/$USER/perl/lib/5.34.0/lib/perl5/JSON/backportPP.pm
  /home/$USER/perl/lib/5.34.0/lib/perl5/JSON/backportPP/Boolean.pm
  /home/$USER/perl/lib/5.34.0/lib/perl5/JSON/backportPP/Compat5005.pm
  /home/$USER/perl/lib/5.34.0/lib/perl5/JSON/backportPP/Compat5006.pm
  /home/$USER/perl/lib/5.34.0/man/man3/JSON.3
  /home/$USER/perl/lib/5.34.0/man/man3/JSON::backportPP.3
  /home/$USER/perl/lib/5.34.0/man/man3/JSON::backportPP::Boolean.3
  /home/$USER/perl/lib/5.34.0/man/man3/JSON::backportPP::Compat5005.3
  /home/$USER/perl/lib/5.34.0/man/man3/JSON::backportPP::Compat5006.3

Are you sure you want to uninstall JSON? [y] y

Unlink: /home/$USER/perl/lib/5.34.0/lib/perl5/JSON.pm
Unlink: /home/$USER/perl/lib/5.34.0/lib/perl5/JSON/backportPP.pm
Unlink: /home/$USER/perl/lib/5.34.0/lib/perl5/JSON/backportPP/Boolean.pm
Unlink: /home/$USER/perl/lib/5.34.0/lib/perl5/JSON/backportPP/Compat5005.pm
Unlink: /home/$USER/perl/lib/5.34.0/lib/perl5/JSON/backportPP/Compat5006.pm
Unlink: /home/$USER/perl/lib/5.34.0/man/man3/JSON.3
Unlink: /home/$USER/perl/lib/5.34.0/man/man3/JSON::backportPP.3
Unlink: /home/$USER/perl/lib/5.34.0/man/man3/JSON::backportPP::Boolean.3
Unlink: /home/$USER/perl/lib/5.34.0/man/man3/JSON::backportPP::Compat5005.3
Unlink: /home/$USER/perl/lib/5.34.0/man/man3/JSON::backportPP::Compat5006.3
Unlink: /home/$USER/perl/lib/5.34.0/lib/perl5/x86_64-linux-thread-multi/auto/JSON/.packlist

Successfully uninstalled JSON

Additional Information

  1. Perl Tutorials
  2. CPAN (Aka App Store for Perl Modules)
  3. CPAN Minus Manual