Perl: List Available Modules, List Module Search Paths

By Xah Lee. Date: . Last updated: .

The standard filename suffix for perl module is “.pm”.

List Available Modules

To get a list of standard module that are bundled with Perl (but not necessarily installed), type in terminal: perldoc perlmodlib.

You can also use the bundled corelist command line util. Use it in terminal.

show usage help.
corelist /JSON/
search by regex on JSON.
corelist Data::Dumper
Show package version and perl version.
◆ corelist -a Data::Dumper

Data::Dumper was first released with perl 5.005
  5.005      2.09
  v5.13.3    2.126
  v5.13.4    2.126
  v5.13.5    2.128
  v5.13.6    2.129
  v5.13.7    2.130_01
  v5.13.8    2.130_02
  v5.13.9    2.130_02
  v5.13.10   2.130_02
  v5.13.11   2.130_02
  v5.14.0    2.130_02
  v5.14.1    2.130_02
  v5.14.2    2.130_02
◆ corelist  /JSON/

JSON::PP was first released with perl v5.13.9

JSON::PP::Boolean was first released with perl v5.13.9

Load a Module

To load a package, call use module_name;. It imports all functions in that package.

# -*- coding: utf-8 -*-
# perl

# loading some commonly used packages
use Data::Dumper;   # for printing list and hash
use File::Find; # for traversing directories

Show Module Documentation

To find out what functions are available in a module, read its documentation, for example perldoc Data::Dumper.

Show Module Load Paths

Predefined variable. A list of library search paths.

Here is a example showing module search paths and loaded modules:

# -*- coding: utf-8 -*-
# perl

use Data::Dumper;

print Dumper \@INC; # prints all module search paths


$VAR1 = [

perldoc perlvar

Show Loaded Modules

Predefined variable. A hash of loaded modules.
# -*- coding: utf-8 -*-
# perl

use Data::Dumper;

print Dumper \%INC; # prints all loaded modules


$VAR1 = {
          'warnings/' => '/usr/share/perl/5.14/warnings/',
          '' => '/usr/share/perl/5.14/',
          '' => '/usr/share/perl/5.14/',
          '' => '/usr/share/perl/5.14/',
          '' => '/usr/share/perl/5.14/',
          '' => '/usr/share/perl/5.14/',
          '' => '/usr/share/perl/5.14/',
          '' => '/usr/share/perl/5.14/',
          'Data/' => '/usr/lib/perl/5.14/Data/'

perldoc perlvar

Perl Module/Package






Data Structure

Loop, Iteration


Text Processing