Perl

Overview

Perl is a programming language which is particularly good for text manipulation.

Versions available: 5.20.2

Restrictions on use

Perl is open source. All users are able to access and use it.

Set up procedure

There is an OS default version of Perl on each iCSF node, you may see the version via

perl -v

To load Perl v5.20.2 on the iCSF:

module load apps/gcc/perl/5.20.2

Installing extra modules

If you try to run a Perl script and it fails to find a module, such as

Can't locate Term/ReadKey.pm in @INC ...

you can usually install the missing one in your home directory from the CPAN archive (unless what you’re running comes with specific different instructions).

To set this up conveniently, do the following (assuming you use the default shell):

eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)

You might want to add that line to your .bashrc file for future use.

Convert the file name from the error message into a module name by replacing / with ::, and then install it similarly to (for the above case):

cpan Term::ReadKey

Hit the return key at any prompts, and it should eventually install the new module under perl5 in your home directory. The procedure may take a while and print lots. The environment variable PERL5LIB needs to be set to ~/perl5/lib/perl5 to find it; the eval step above does that. You can install multiple modules by passing the names as arguments to cpan, or just use cpan multiple times.

The installation procedure will only work on the login nodes, but you can use the result on compute nodes as long as PERL5LIB is set correctly. Doing the installation will currently only work with the default Perl version, not the ones requiring modules, but the result should be usable with others if the eval step is done before loading the module.

Further info

Last modified on October 12, 2020 at 9:36 am by Ben Pietras