Perl Documentation

Perldoc Overview | Functions & Frequently Asked Question (FAQ)s | Modules | Converting POD

Perl has copious documentation in Plain Old Documentation (POD) format. Knowing where to look for this documentation will benefit anyone doing Perl programming. Try perlmeme.org or PerlMonks for Perl code examples.

Perldoc Overview

Use the perldoc command to access the builtin documentation. For instance, for general information about perl and an index of other documentation, run the following commands:

$ perldoc perl
$ perldoc perltoc

If you do not have perldoc(1) available on your system, you can access the Perl documentation on the web or directly via perl, perltoc. In the case of some Linux systems (Mandrake, Debian), the Perl documentation may not be installed with the perl package. On Debian, install perl-doc via apt-get.

# apt-get install perl-doc

Or, the documentation may be available via a special application, for example Shuck on the (now quite ancient) Mac OS Classic version of perl. On Mac OS X, be sure to install XCode (formerly known as Developer’s Tools).

On many Unix systems, the perldoc will have been rendered into man(1) pages. If this is the case, using man may bring up the documentation faster than perldoc can.

$ man perl

Functions & Frequently Asked Question (FAQ)s

Until you memorize all the functions, their arguments, and return values (i.e. never), either read the perlfunc page (with the handy introduction and grouping of functions by category), or use the -f argument to perldoc:

$ perldoc perlfunc

$ perldoc -f abs
abs VALUE
abs Returns the absolute value of its argument. If
VALUE is omitted, uses $_.

Similarly, one can lookup questions in the numerous perlfaq documents with the -q option to perldoc:

$ perldoc -q lock

However, the FAQ Keyword lookup often requires one to know what the title of the FAQ entry is before being able to craft an appropriate keyword lookup. In this case, podgrep and similar from the pmtools suite may allow for better search results.

Modules

To read the documentation for a specific perl module (e.g. Digest::MD5), use the following:

$ perldoc Digest::MD5

If the module is not installed on the system, the following URL can be used to search for module documentation on the Comprehensive Perl Archive Network (CPAN):

http://search.cpan.org/perldoc/Digest::MD5

Use the ow script to expand URL on the command line. ow will pass the URL to a browser by default, or display the URL for manual copying:

$ ow -l perldoc SOAP::Lite
http://search.cpan.org/perldoc/SOAP::Lite

Converting POD

To render POD into other formats, see the Pod::Simple perl module.