Perl

Perl is available through the Spack package manager with support for scripting, CPAN package management, and comprehensive standard library.

Quick Start

Note

For the value of ${SPACK_ROOT}, Please refer to Spack Instances for the installation path.

# Modify this path accordingly
export SPACK_ROOT="/path/to/spack"

# Activate Spack environment
source "${SPACK_ROOT}/dist/bin/setup-env.sh" -y

# Check available Perl versions
module avail perl

# Load Perl
module load perl/5.40

# Verify installation
perl --version

# Run Perl code
perl -e 'print "Hello, World!\n"'

# Run a script
perl my_script.pl

Note

Module names may include a 7-digit hash suffix (e.g., perl/5.40.0-abc123d). You do NOT need to include this hash when loading - the version alone (e.g., 5.40) is sufficient.

Tutorials

Features Availability

Feature / Version

Perl 5.40

Others [1]

Installed

✓ (Default)

[1]

Perl Interpreter

CPAN Package Manager

cpanm (App::cpanminus)

Available via CPAN

SLURM Compatibility

Notes:

[1] Others (Perl 5.x versions): Can be installed on your own via Spack (not pre-installed as module). Self-installed versions have not been tested by HPC team.

Environment Variables

When loading the Perl module, the following environment variables are set automatically.

PERL5LIB

Specifies the directories to search for Perl library files and modules.

Default: $HOME/.perl5/lib/perl5

PERL_LOCAL_LIB_ROOT

Points to the root directory of the local Perl library installation.

Default: $HOME/.perl5

PERL_MB_OPT

Options passed to Module::Build for building and installing Perl modules.

Default: --install_base "$HOME/.perl5"

PERL_MM_OPT

Options passed to ExtUtils::MakeMaker for building and installing Perl modules.

Default: INSTALL_BASE=$HOME/.perl5

PERL_CPAN_MIRROR

Specifies the CPAN mirror URL for downloading Perl modules.

Default: https://www.cpan.org/

Note

These environment variables are automatically configured when you load the Perl module. They enable local installation of CPAN modules in your home directory without requiring root privileges. You typically don’t need to modify them manually.

Support and Resources

Perl Documentation

Learning Resources