Perl 101: Things Every Perl Programmer Should Know.

Documentation

perldoc

  • Perldoc is the complete language reference for Perl
  • perldoc perldoc for usage instructions
  • perldoc perl for an overview of the documentation
  • perldoc Module for a module's documentation

Look up any function with perldoc -f

    $ perldoc -f system

       system LIST
       system PROGRAM LIST
               Does exactly the same thing as "exec LIST", except that a fork
               is done first, and the parent process waits for the child
       ...

Search the Perl FAQ with perldoc -q

    $ perldoc -q database

    Found in /System/Library/Perl/5.8.6/pods/perlfaq8.pod
       How do I use an SQL database?

       The DBI module provides an abstract interface to most database servers
       and types, including Oracle, DB2, Sybase, mysql, Postgresql, ODBC, and

Look up module documents with perldoc modulename

If a module is installed on your system, you can see the docs for it.

    $ perldoc WWW::Mechanize

    NAME
       WWW::Mechanize -- Handy web browsing in a Perl object

    VERSION
       Version 1.20

    SYNOPSIS
       "WWW::Mechanize", or Mech for short, helps you automate interaction
       with a website. It supports performing a sequence of page fetches

For modules that you haven't installed, you'll need to use http://search.cpan.org.

Online documentation

There are some websites that HTMLify the Perl documentation. The two biggest ones:

Writing your own documentation

Perl has a strong culture of documenting everything, and you are encouraged to get into this habit early on. You'll write your documentation using a format called POD, which is discussed in its own page.


Want to contribute?

Submit a PR to github.com/petdance/perl101


Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.