The standard Perl distribution comes with complete online documentation called man pages, which provide help for all the standard utilities. (The name derives from the UNIX man [manual] pages.) Perl has divided its man pages into categories. If you type the following at your command-line prompt:
man perl
you will get a list of all the sections by category. So, if you want help on how to use Perl's regular expresssions, you would type
man perlre
and if you want help on subroutines, you would type
man perlsub
The Perl categories are listed as follows, with the following sections available only in the online reference manual:
perlbot | Object-oriented tricks and examples |
perldebug | Debugging |
perldiag | Diagnostic messages |
perldsc | Data structures: intro |
perlform | Formats |
perlfunc | Built-in functions |
perlipc | Interprocess communication |
perllol | Data structures: lists of lists |
perlmod | Modules |
perlobj | Objects |
perlop | Operators and precedence |
perlpod | Plain old documentation |
perlre | Regular expressions |
perlref | References |
perlsock | Extension for socket support |
perlstyle | Style guide |
perlsub | Subroutines |
perltie | Objects hidden behind simple variables |
perltrap | Traps for the unwary |
perlvar | Predefined variables |
If you are trying to find out how a particular library module works, you can use the perldoc command to get the documentation. For example, if you want to know about the CGI.pm module, type at the command line
perldoc CGI
and the documentation for the CGI.pm module will be displayed. If you type
perldoc English
the documentation for the English.pm module will be displayed.
To get documentation on a specific Perl function, type perldoc -f and the name of the function. For example, to find out about the localtime function, you would execute the following command at your command-line prompt. (You may have to set your UNIX/DOS path to execute this program directly.)
perldoc -f localtime
localtime EXPR
localtime
Converts a time as returned by the time function to a 9-element
list with the time analyzed for the local time zone. Typically
used as follows:
# 0 1 2 3 4 5 6 7 8
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
<continues>
ActivePerl provides execllent documentation (from ActiveState.com) when you download Perl from its site. As shown in Figure 1.6, there are links to everything you need to know about Perl.