Look Up Perl Terms Fast with perlglossary
Half of learning Perl is decoding what the manuals mean by "context" or "glob", and perlglossary is the dictionary nobody tells you to open. You will use the installed reference to look up Perl vocabulary from a shell, search its definitions, and move between the terminal man page and the Perl documentation file.
The route
Jump straight to the step you need, or tick off Done means at the end.
Allow about ten minutes. You need a Linux shell and the perl-doc package; no elevated privileges are needed.
This is a reference document, not a program that performs a conversion or changes a Perl installation. That distinction avoids the most common mistake: trying to pass a term to perlglossary as though it were an executable.
1. Confirm the installed documentation
Check the Perl and package versions first. Version details matter because the local page and the current upstream page can describe different glossary revisions:
$ perl -v | sed -n '1,3p'
This is perl 5, version 38, subversion 2 (v5.38.2) built for x86_64-linux-gnu-thread-multi
(with 67 registered patches, see perl -V for more detail)
$ dpkg-query -W -f='${Package} ${Version}\n' perl-doc
perl-doc 5.38.2-3.2ubuntu0.6
On this machine the man page reports perlglossary version 5.20210520, while the installed Perl runtime is 5.38.2. The page version is the useful identifier for the glossary text itself; a later Perl package may contain newer definitions.
Checkpoint
Confirm the manual is discoverable before looking for a definition.
$ command -v man
/usr/bin/man
$ man -f perlglossary
perlglossary (1) - Perl Glossary
2. Open the glossary in the terminal
Open the complete reference with section 1 specified explicitly:
$ man 1 perlglossary
The terminal viewer normally opens at the beginning. Type /array context and press Enter to search, then use n for the next match. Press q to leave the viewer. The glossary runs alphabetically from A to Z, so searching beats paging through it once you already know the term.
Definitions in the page use cross-references such as list context or hash. A bold term means the glossary defines it elsewhere. Search that exact term when the first definition assumes vocabulary you do not yet know.
3. Extract a definition for a quick check
When you need a small, script-friendly excerpt rather than an interactive viewer, render the page without terminal formatting and search the result:
$ man perlglossary | col -b | grep -A 8 -m 1 '^ array context$'
array context
An archaic expression for what is more correctly referred to as
list context.
col -b removes backspace-based formatting that a man page can use for bold text. The exact spacing and wrapping can vary with the installed formatter and terminal width, so treat this as a way to find a passage, not a stable data format. The exit status is also useful in a script: grep returns failure when the term is absent.
For a case-insensitive search across the rendered page, use grep -i:
$ man perlglossary | col -b | grep -i -m 5 'taint'
taint checks
tainted
taint mode
This lists matching lines, not necessarily complete definitions. Use the interactive page when context matters.
4. Use perldoc when the man viewer is unavailable
Perl also ships the glossary as a POD documentation file. perldoc can display it using Perl's documentation path:
$ perldoc perlglossary | sed -n '1,8p'
NAME
perlglossary - Perl Glossary
VERSION
version 5.20210520
DESCRIPTION
A glossary of terms (technical and otherwise) used in the Perl
Find the source file without opening it with perldoc -l:
$ perldoc -l perlglossary
/usr/share/perl/5.38/pod/perlglossary.pod
The file path is package-specific. Do not hard-code it in a script when perldoc perlglossary is enough. If perldoc cannot find the page, check that perl-doc is installed and that you are invoking the perldoc belonging to the Perl installation you intend to use.
Common traps
- Treating it as a syntax reference. Use
perlglossaryto clarify terminology, not to settle every question about syntax, module interfaces or security behaviour; look up the dedicated Perl manual page for an operator or function instead. A glossary entry can explain what ascalaris, but it is not a substitute for the documentation of a particular function's context rules. - Assuming every entry is current advice. Glossaries preserve historical vocabulary alongside current concepts; a term's presence does not mean it is recommended in new code. The local page even points
associative arraytohash. - Piping output to a file and forgetting it. No command in this workflow writes files, changes Perl configuration or needs
sudo. If you redirected output while experimenting, remove only that deliberately named temporary file after checking it; the man page and POD source stay unchanged.
Done means
- Manual found.
man -f perlglossaryfinds the Perl Glossary on the host. - Full reference opened.
man 1 perlglossaryopens the complete alphabetised reference. - Search works both ways. You can search interactively with
/termandn, or extract rendered text withcol -b. - Second view available.
perldoc perlglossaryprovides a second local view, andperldoc -lreveals its installed source path. - Scope kept separate. You know the local glossary revision and have kept terminology lookup separate from changes to Perl or the operating system.