PERLDOC(1perl)
π PERLDOC π
okay bestie, gather round, because perldoc is the girl who looks up Perl documentation in Pod format and she always comes through. iykyk. π
β¨ NAME β¨
perldoc β look up Perl documentation in Pod format. that's it, that's the whole vibe. π
πΈ SYNOPSIS πΈ
so here's how you summon her:
perldoc [-h] [-D] [-t] [-u] [-m] [-l] [-U] [-F]
[-i] [-V] [-T] [-r]
[-d destination_file]
[-o formatname]
[-M FormatterClassName]
[-w formatteroption:value]
[-n nroff-replacement]
[-X]
[-L language_code]
PageName|ModuleName|ProgramName|URL
and here's what it actually looks like when you're living your life:
perldoc -f BuiltinFunction
perldoc -L it -f BuiltinFunction
perldoc -q FAQ Keyword
perldoc -L fr -q FAQ Keyword
perldoc -v PerlVariable
perldoc -a PerlAPI
more deets on all the switches below, bestie π
π¦ DESCRIPTION π¦
perldoc looks up documentation in .pod format β that stuff is literally embedded in the perl installation tree or hiding inside a perl script β and then it shows it to you using a bunch of different formatters. it's mostly for the docs of the perl library modules. main character behavior fr fr.
lowkey tho: your system might also have man pages installed for those modules, and if it does you can probably just use the man(1) command and be fine. π
oh and if you're hunting for a table of contents to the Perl library modules documentation? go see the perltoc page.
π OPTIONS π
-hβ prints out a lil brief help message. short and sweet. π«Ά-Dβ describes the search for the item in detail. receipts, basically.-tβ display docs using the plain text converter instead of nroff. might be faster, but ngl it probably won't look as nice. π-uβ skip the real Pod formatting and just show the raw Pod source. unformatted, unfiltered, unbothered. π-mmodule β display the ENTIRE module: both the code AND the unformatted pod documentation. super useful when the docs don't explain a function in the detail you need and you wanna go inspect the code directly;perldocwill find the file for you and just hand it off for display. no cap.-lβ display only the file name of the module found. that's it. just the name. π-Uβ when running as the superuser, don't attempt to drop privileges for security. this option is implied with-F.
NOTE: please see the heading SECURITY below for more info!! don't skip it bestie π
-Fβ consider arguments as file names; no search in directories will be performed. implies-Uif run as the superuser.-fperlfunc β the-foption followed by the name of a perl built-in function will extract the documentation of that function fromperlfunc.
Example:
perldoc -f sprintf
-qperlfaq-search-regexp β the-qoption takes a regular expression as an argument. it will search the question headings inperlfaq[1-9]and print the entries matching that regex.
Example:
perldoc -q shuffle
-aperlapifunc β the-aoption followed by the name of a perl api function will extract the documentation of that function fromperlapi.
Example:
perldoc -a newHV
-vperlvar β the-voption followed by the name of a Perl predefined variable will extract the documentation of that variable fromperlvar.
Examples:
perldoc -v '$"'
perldoc -v @+
perldoc -v DATA
-Tβ says the output is NOT to be sent to a pager, but sent straight toSTDOUT. direct line, no middleman. β¨-ddestination-filename β says the output goes neither to a pager nor toSTDOUT, but gets saved to the filename you specified. Example:perldoc -oLaTeX -dtextwrapdocs.tex Text::Wrap-ooutput-formatname β tells Perldoc to try using a Pod-formatting class for the output format you name. like:-oman. this is actually just a wrapper around the-Mswitch; using-oformatnamejust looks for a loadable class by adding that format name (with different capitalizations) onto the end of different classname prefixes.
for example, -oLaTeX currently tries all of the following classes: Pod::Perldoc::ToLaTeX Pod::Perldoc::Tolatex Pod::Perldoc::ToLatex Pod::Perldoc::ToLATEX Pod::Simple::LaTeX Pod::Simple::latex Pod::Simple::Latex Pod::Simple::LATEX Pod::LaTeX Pod::latex Pod::Latex Pod::LATEX. she's thorough. π
-Mmodule-name β names the module you want to try using for formatting the pod. the class has to at least provide aparse_from_filemethod. like:perldoc -MPod::Perldoc::ToChecker.
you can specify several classes to try by joining them with commas or semicolons, as in -MTk::SuperPod;Tk::Pod.
-woption:value or-woption β names an option to call the formatter with. for example,-w textsize:15will call$formatter->textsize(15)on the formatter object before it's used to format the object. for this to be valid, the formatter class must provide such a method, and the value you pass should be valid. (so iftextsizeexpects an integer and you do-w textsize:bigβ¦ expect trouble. π)
you can use -w optionname (no value) as shorthand for -w optionname:TRUE. presumably useful for on/off features like -w page_numbering.
you can use an = instead of the :, as in -w textsize=15. might be more (or less) convenient depending on which shell you use. π
-Xβ use an index if one is present. the-Xoption looks for an entry whose basename matches the name given on the command line in the file$Config{archlib}/pod.idx. thepod.idxfile should contain fully qualified filenames, one per line.-Llanguage_code β lets you specify the language code for the translation you want. if thePOD2::<language_code>package isn't installed on your system, the switch is just ignored, no drama. all available translation packages live under thePOD2::namespace. seePOD2::IT(orPOD2::FR) to see how to create new localizedPOD2::*documentation packages and integrate them intoPod::Perldoc.PageName|ModuleName|ProgramName|URLβ the item you wanna look up. nested modules (likeFile::Basename) are specified either asFile::BasenameorFile/Basename. you can also give a descriptive name of a page, likeperlfunc. for URLs, HTTP and HTTPS are the only kinds currently supported.
for simple names like 'foo', when the normal search fails to find a matching page, a search with the perl prefix is tried as well. so perldoc intro is enough to find/render perlintro.pod. slay. β¨
-nsome-formatter β specify replacement for groff.-rβ recursive search. π-iβ ignore case.-Vβ displays the version ofperldocyou're running.
π₯ SECURITY π₯
okay bestie, serious face for a sec. π«Ά
because perldoc does not run properly tainted, and is known to have security issues, when run as the superuser it will attempt to drop privileges by setting the effective and real IDs to nobody's or nouser's account, or -2 if unavailable. if it cannot relinquish its privileges, it will not run. periodt.
see the -U option if you don't want this behavior β but beware, there are significant security risks if you choose to use -U. like, genuinely. don't be cute about it. π
since 3.26, using -F as the superuser also implies -U, because opening most files and traversing directories requires privileges above the nobody/nogroup level.
π ENVIRONMENT π
any switches in the PERLDOC environment variable will be used before the command line arguments.
useful values for PERLDOC include -oterm, -otext, -ortf, -oxml, and so on, depending on what modules you have on hand; or the formatter class may be specified exactly with -MPod::Perldoc::ToTerm or the like.
perldoc also searches directories specified by the PERL5LIB (or PERLLIB if PERL5LIB is not defined) and PATH environment variables. (the latter is so that embedded pods for executables, like perldoc itself, are available.)
in directories where either Makefile.PL or Build.PL exist, perldoc will add . and lib first to its search path, and as long as you're not the superuser it'll add blib too. this is really helpful if you're working inside a build directory and wanna read through the docs even when you have a version of a module previously installed. π
perldoc will use, in order of preference, the pager defined in PERLDOC_PAGER, MANPAGER, or PAGER before trying to find a pager on its own. (MANPAGER is not used if perldoc was told to display plain text or unformatted pod.)
when using perldoc in its -m mode (display module source code), perldoc will attempt to use the pager set in PERLDOC_SRC_PAGER. a useful setting for this command is your favorite editor, as in /usr/bin/nano. (don't judge me.) π
one useful value for PERLDOC_PAGER is less -+C -E.
having PERLDOCDEBUG set to a positive integer will make perldoc emit even more descriptive output than the -D switch does; the higher the number, the more it emits. the higher the number, the more it emits β iconic.
π CHANGES π
up to 3.14_05, the switch -v was used to produce verbose messages of perldoc operation, which is now enabled by -D. glow up. π
β SEE ALSO β
perlpod, Pod::Perldoc
π AUTHOR π
current maintainer: Mark Allen <mallen@cpan.org>
past contributors are: brian d foy <bdfoy@cpan.org> Adriano R. Ferreira <ferreira@cpan.org>, Sean M. Burke <sburke@cpan.org>, Kenneth Albanowski <kjahds@kjahds.com>, Andy Dougherty <doughera@lafcol.lafayette.edu>, and many others. absolute legends, every single one. π«Ά
and that's the whole page bestie, no notes. this was perl v5.44.0, dated 2026-10-17 β so go forth, look up your docs, and be the most informed girl in the group chat. bye mwah πβ¨π
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms