---
title: "Perl"
id: "11218"
type: "epkb_post_type_1"
slug: "perl"
published_at: "2014-05-06T15:56:35+00:00"
modified_at: "2024-04-29T15:28:42+00:00"
url: "https://docs.rc.fas.harvard.edu/kb/perl/"
markdown_url: "https://docs.rc.fas.harvard.edu/kb/perl.md"
excerpt: "Introduction & Setup Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl packages are provided by CPAN. For newer versions of Perl, we recommend installing via Spack. cpan The CPAN module and it’s command line tool (cpan) can be..."
taxonomy_epkb_post_type_1_category:
  - "Languages"
taxonomy_epkb_post_type_1_tag:
  - "software"
---

# Perl

### Introduction & Setup

Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl packages are provided by [CPAN](https://www.cpan.org/)
. For newer versions of Perl, we recommend installing via [Spack](https://docs.rc.fas.harvard.edu/kb/spack/)
.

### cpan

The CPAN module and it’s command line tool (`cpan`) can be used to install modules by name from the CPAN repository. Additionally, it recursively installs any modules that it depends on. If you’re using the `cpan` command for the first time, you’ll need to run through a series of configuration prompts. Running the cpan command will initiate a configuration session.

You may be prompted at the end to manually set the download URL list. Use the `o conf init urllist` command to initiate the configuration.  
 [https://docs.rc.fas.harvard.edu/wp-content/uploads/2014/07/cpan4.png](https://docs.rc.fas.harvard.edu/wp-content/uploads/2014/07/cpan4.png)

Setting the download URL preferences from the cpan prompt.

You may also want cpan to automatically install dependencies. This can either be set in the interactive configuration, or later at the cpan prompt using the command:

```
cpan> o conf prerequisites_policy follow
```

Once cpan is setup, either simple one line command at the terminal prompt can be used to install CPAN modules:

```
perl -MCPAN -e 'install DBD::SQLite'   OR   cpan DBD::SQLite
```

Of course, your module will be something other than ‘DBD::SQLite’

Alternatively, `cpan` can be run interactively.  
 [https://docs.rc.fas.harvard.edu/wp-content/uploads/2014/07/cpan6.png](https://docs.rc.fas.harvard.edu/wp-content/uploads/2014/07/cpan6.png)

CPAN module install from the interactive shell

### Examples

[FASRC User Codes](https://github.com/fasrc/User_Codes/tree/master/Languages/Perl)

Bookmarkable Links

- [1. Introduction & Setup](#Introduction_Setup)
- [2. cpan](#cpan)
- [3. Examples](#Examples)

Last UpdatedApril 29, 2024

Tags: - [software](https://docs.rc.fas.harvard.edu/kb/tag/software/)
