perldoc
View Perl documentation
TLDR
View documentation for a builtin [f]unction, a [v]ariable or an [a]PI
Search in the question headings of Perl FAQ
Send output directly to stdout (by default, it is send to a pager)
Specify the language code of the desired translation
SYNOPSIS
perldoc [options] pageitem...
perldoc -f function_name
perldoc -q search_term
perldoc -h|--help
perldoc -v|--version
PARAMETERS
-f function
Displays documentation for the specified Perl built-in function.
-l
Displays the full path to the document without showing its content.
-m module
Displays documentation for a specific Perl module.
-q search_term
Searches the Perl FAQ (Frequently Asked Questions) for answers matching the search_term.
-v
Displays the version of the perldoc utility.
-t
Formats the output as plain text, disabling formatting like bold/underline.
-u
Unformatted. Displays the raw POD (Plain Old Documentation) source.
-x
Executes the module as a Perl script, displaying its output.
-d directory
Specifies an additional directory to search for modules.
-D
Dumps the POD options for debugging purposes.
-h
Displays a brief help message and exits.
-o filename
Prints output to the specified filename instead of stdout.
-n formatter
Specifies a specific POD formatter module to use (e.g., Pod::Text::Color).
-M module
Specifies a formatting module class to use (e.g., Pod::Man).
-P
Forces piping output through less (often the default pager).
-T
Prevents perldoc from using any pager, printing directly to standard output.
-w width
Sets the output text width for formatting.
-X
Disables the pager (same as -T).
-F
Disables the use of Pod::Find for searching documents.
-L linktext
Specifies text for internal links, usually for advanced formatting.
-R name
Restricts search to sections named name (e.g., SYNOPSIS).
-a
Displays all matching POD documents found, not just the first one.
-b
For backward compatibility with older Pod::Text versions.
-i
Performs case-insensitive search for the page item.
-s
Searches for the page item in all known POD directories.
DESCRIPTION
perldoc is a utility that displays sections of the Perl manual in plain text, typically using a pager like less or more. It can find documentation for Perl functions, modules, scripts, and general Perl topics. The documentation is usually in POD (Plain Old Documentation) format. perldoc helps users quickly access detailed information about Perl's syntax, built-in functions, standard library modules, and common programming practices without needing an internet connection, provided the documentation is installed locally. It is an essential tool for Perl developers for quick reference and learning, streamlining the process of looking up language constructs and module functionalities.
CAVEATS
perldoc relies on locally installed Perl documentation; if documentation is missing or incomplete, it cannot display it. Output formatting might vary depending on available Pod::* modules and terminal capabilities. Searching for a pageitem can be ambiguous if multiple modules or functions share similar names, sometimes requiring a more precise query.
SEARCHING FOR MODULES AND FUNCTIONS
perldoc intelligently guesses whether you're looking for a module, a function, or a general topic. Use `perldoc ModuleName` (e.g., `perldoc Data::Dumper`) for modules or `perldoc -f functionName` (e.g., `perldoc -f chomp`) for built-in functions.
FAQ LOOKUP
The `-q` option is particularly useful for quickly finding answers to common Perl questions without needing to browse the full FAQ. For instance, `perldoc -q array` searches for FAQ entries related to arrays.
ENVIRONMENT VARIABLES
The `PERL5LIB` and `PERL5OPT` environment variables can influence where perldoc searches for modules. Additionally, the `PAGER` environment variable can be used to specify an alternative pager program to less or more.
HISTORY
perldoc has been a standard utility distributed with Perl for a long time, evolving alongside the language. It simplifies access to Perl's extensive documentation, which is largely written in POD format. Its development reflects the Perl community's commitment to self-contained, easily accessible documentation, integrated directly into the Perl distribution.