PERL(1)

๐Ÿ“ฆ
version 5.40.1 ยท 5 versions
, in ubuntu questing

๐ŸŒธ NAME ๐ŸŒธ

perl โ€” The Perl 5 language interpreter ๐Ÿ’–

Like, that's her. That's the whole thing. She runs Perl 5 and she's been doing it since before you were born, bestie.


โœจ SYNOPSIS โœจ

perl [ -sTtuUWX ]
        [ -hv ] [ -V[:configvar] ]
        [ -cw ] [ -d[t][:debugger] ] [ -D[number/list] ]
        [ -pna ] [ -Fpattern ] [ -l[octal] ] [ -0[octal/hexadecimal] ]
        [ -Idir ] [ -m[-]module ] [ -M[-]'module...' ] [ -f ]
        [ -C [number/list] ]
        [ -S ]
        [ -x[dir] ]
        [ -i[extension] ]
        [ [-e|-E] 'command' ] [ -- ] [ programfile ] [ argument ]...

Wanna know what every single one of those little letters does? Run this, no cap:

perldoc perlrun

๐Ÿซถ GETTING HELP ๐Ÿซถ

Okay so perldoc is your new bestie โ€” it hands you all the documentation that ships with Perl. And if you want more docs, tutorials, and actual community support from real humans, they're online at <https://www.perl.org/>. ๐ŸŒโœจ

New to Perl? Do not just rawdog the manual, I'm begging you ๐Ÿ˜ญ. Start here:

perldoc perlintro

That's the general intro for beginners and it gives you the background you need so the rest of Perl's extensive documentation doesn't feel like a jumpscare. Once you're done there, run:

perldoc perldoc

and it'll show you all the other cute things perldoc can do for you. ๐ŸŽ€

And for ease of access (because the Perl manual is, respectfully, enormous), it's been split up into several sections. Here's the map:

๐Ÿฆ‹ Overview

  • perl โ€” Perl overview (this section, hi, you're here ๐Ÿ’…)
  • perlintro โ€” Perl introduction for beginners
  • perlrun โ€” Perl execution and options
  • perltoc โ€” Perl documentation table of contents

๐ŸŒˆ Tutorials

  • perlreftut โ€” Perl references short introduction
  • perldsc โ€” Perl data structures intro
  • perllol โ€” Perl data structures: arrays of arrays
  • perlrequick โ€” Perl regular expressions quick start
  • perlretut โ€” Perl regular expressions tutorial
  • perlootut โ€” Perl OO tutorial for beginners
  • perlperf โ€” Perl Performance and Optimization Techniques
  • perlstyle โ€” Perl style guide
  • perlcheat โ€” Perl cheat sheet
  • perltrap โ€” Perl traps for the unwary
  • perldebtut โ€” Perl debugging tutorial
  • perlfaq โ€” Perl frequently asked questions
    • perlfaq1 โ€” General Questions About Perl
    • perlfaq2 โ€” Obtaining and Learning about Perl
    • perlfaq3 โ€” Programming Tools
    • perlfaq4 โ€” Data Manipulation
    • perlfaq5 โ€” Files and Formats
    • perlfaq6 โ€” Regexes
    • perlfaq7 โ€” Perl Language Issues
    • perlfaq8 โ€” System Interaction
    • perlfaq9 โ€” Networking

๐Ÿ‘‘ Reference Manual

  • perlsyn โ€” Perl syntax: declarations, statements, comments
  • perldata โ€” Perl data structures
  • perlop โ€” Perl expressions: operators, precedence, string literals
  • perlsub โ€” Perl subroutines
  • perlfunc โ€” Perl built-in functions
    • perlopentut โ€” Perl open() tutorial
    • perlpacktut โ€” Perl pack() and unpack() tutorial
  • perlpod โ€” Perl plain old documentation
  • perlpodspec โ€” Perl plain old documentation format specification
  • perldocstyle โ€” Perl style guide for core docs
  • perlpodstyle โ€” Perl POD style guide
  • perldiag โ€” Perl diagnostic messages
  • perldeprecation โ€” Perl deprecations
  • perllexwarn โ€” Perl warnings and their control
  • perldebug โ€” Perl debugging
  • perlvar โ€” Perl predefined variables
  • perlre โ€” Perl regular expressions, the rest of the story
  • perlrebackslash โ€” Perl regular expression backslash sequences
  • perlrecharclass โ€” Perl regular expression character classes
  • perlreref โ€” Perl regular expressions quick reference
  • perlref โ€” Perl references, the rest of the story
  • perlform โ€” Perl formats
  • perlobj โ€” Perl objects
  • perltie โ€” Perl objects hidden behind simple variables
    • perldbmfilter โ€” Perl DBM filters
  • perlclass โ€” Perl class syntax
  • perlipc โ€” Perl interprocess communication
  • perlfork โ€” Perl fork() information
  • perlnumber โ€” Perl number semantics
  • perlthrtut โ€” Perl threads tutorial
  • perlport โ€” Perl portability guide
  • perllocale โ€” Perl locale support
  • perluniintro โ€” Perl Unicode introduction
  • perlunicode โ€” Perl Unicode support
  • perlunicook โ€” Perl Unicode cookbook
  • perlunifaq โ€” Perl Unicode FAQ
  • perluniprops โ€” Index of Unicode properties in Perl
  • perlunitut โ€” Perl Unicode tutorial
  • perlebcdic โ€” Considerations for running Perl on EBCDIC platforms
  • perlsec โ€” Perl security
  • perlsecpolicy โ€” Perl security report handling policy
  • perlmod โ€” Perl modules: how they work
  • perlmodlib โ€” Perl modules: how to write and use
  • perlmodstyle โ€” Perl modules: how to write modules with style
  • perlmodinstall โ€” Perl modules: how to install from CPAN
  • perlnewmod โ€” Perl modules: preparing a new module for distribution
  • perlpragma โ€” Perl modules: writing a user pragma
  • perlutil โ€” utilities packaged with the Perl distribution
  • perlfilter โ€” Perl source filters
  • perldtrace โ€” Perl's support for DTrace
  • perlglossary โ€” Perl Glossary

๐Ÿ’œ Internals and C Language Interface

  • perlembed โ€” Perl ways to embed perl in your C or C++ application
  • perldebguts โ€” Perl debugging guts and tips
  • perlxstut โ€” Perl XS tutorial
  • perlxs โ€” Perl XS application programming interface
  • perlxstypemap โ€” Perl XS C/Perl type conversion tools
  • perlclib โ€” Interacting with standard C library functions
  • perlguts โ€” Perl internal functions for those doing extensions
  • perlcall โ€” Perl calling conventions from C
  • perlmroapi โ€” Perl method resolution plugin interface
  • perlreapi โ€” Perl regular expression plugin interface
  • perlreguts โ€” Perl regular expression engine internals
  • perlclassguts โ€” Internals of class syntax
  • perlapi โ€” Perl API listing (autogenerated)
  • perlintern โ€” Perl internal functions (autogenerated)
  • perliol โ€” C API for Perl's implementation of IO in Layers
  • perlapio โ€” Perl internal IO abstraction interface
  • perlhack โ€” Perl hackers guide
  • perlsource โ€” Guide to the Perl source tree
  • perlinterp โ€” Overview of the Perl interpreter source and how it works
  • perlhacktut โ€” Walk through the creation of a simple C code patch
  • perlhacktips โ€” Tips for Perl core C code hacking
  • perlpolicy โ€” Perl development policies
  • perlgov โ€” Perl Rules of Governance
  • perlgit โ€” Using git with the Perl repository

โœจ History โœจ

the receipts, the lore, the whole timeline bestie ๐Ÿ’–

  • perlhist โ€” Perl history records
  • perldelta โ€” Perl changes since previous version
  • perl5400delta โ€” Perl changes in version 5.40.0
  • perl5382delta โ€” Perl changes in version 5.38.2
  • perl5381delta โ€” Perl changes in version 5.38.1
  • perl5380delta โ€” Perl changes in version 5.38.0
  • perl5363delta โ€” Perl changes in version 5.36.3
  • perl5362delta โ€” Perl changes in version 5.36.2
  • perl5361delta โ€” Perl changes in version 5.36.1
  • perl5360delta โ€” Perl changes in version 5.36.0
  • perl5343delta โ€” Perl changes in version 5.34.3
  • perl5342delta โ€” Perl changes in version 5.34.2
  • perl5341delta โ€” Perl changes in version 5.34.1
  • perl5340delta โ€” Perl changes in version 5.34.0
  • perl5321delta โ€” Perl changes in version 5.32.1
  • perl5320delta โ€” Perl changes in version 5.32.0
  • perl5303delta โ€” Perl changes in version 5.30.3
  • perl5302delta โ€” Perl changes in version 5.30.2
  • perl5301delta โ€” Perl changes in version 5.30.1
  • perl5300delta โ€” Perl changes in version 5.30.0
  • perl5283delta โ€” Perl changes in version 5.28.3
  • perl5282delta โ€” Perl changes in version 5.28.2
  • perl5281delta โ€” Perl changes in version 5.28.1
  • perl5280delta โ€” Perl changes in version 5.28.0
  • perl5263delta โ€” Perl changes in version 5.26.3
  • perl5262delta โ€” Perl changes in version 5.26.2
  • perl5261delta โ€” Perl changes in version 5.26.1
  • perl5260delta โ€” Perl changes in version 5.26.0
  • perl5244delta โ€” Perl changes in version 5.24.4
  • perl5243delta โ€” Perl changes in version 5.24.3
  • perl5242delta โ€” Perl changes in version 5.24.2
  • perl5241delta โ€” Perl changes in version 5.24.1
  • perl5240delta โ€” Perl changes in version 5.24.0
  • perl5224delta โ€” Perl changes in version 5.22.4
  • perl5223delta โ€” Perl changes in version 5.22.3
  • perl5222delta โ€” Perl changes in version 5.22.2
  • perl5221delta โ€” Perl changes in version 5.22.1
  • perl5220delta โ€” Perl changes in version 5.22.0
  • perl5203delta โ€” Perl changes in version 5.20.3
  • perl5202delta โ€” Perl changes in version 5.20.2
  • perl5201delta โ€” Perl changes in version 5.20.1
  • perl5200delta โ€” Perl changes in version 5.20.0
  • perl5184delta โ€” Perl changes in version 5.18.4
  • perl5182delta โ€” Perl changes in version 5.18.2
  • perl5181delta โ€” Perl changes in version 5.18.1
  • perl5180delta โ€” Perl changes in version 5.18.0
  • perl5163delta โ€” Perl changes in version 5.16.3
  • perl5162delta โ€” Perl changes in version 5.16.2
  • perl5161delta โ€” Perl changes in version 5.16.1
  • perl5160delta โ€” Perl changes in version 5.16.0
  • perl5144delta โ€” Perl changes in version 5.14.4
  • perl5143delta โ€” Perl changes in version 5.14.3
  • perl5142delta โ€” Perl changes in version 5.14.2
  • perl5141delta โ€” Perl changes in version 5.14.1
  • perl5140delta โ€” Perl changes in version 5.14.0
  • perl5125delta โ€” Perl changes in version 5.12.5
  • perl5124delta โ€” Perl changes in version 5.12.4
  • perl5123delta โ€” Perl changes in version 5.12.3
  • perl5122delta โ€” Perl changes in version 5.12.2
  • perl5121delta โ€” Perl changes in version 5.12.1
  • perl5120delta โ€” Perl changes in version 5.12.0
  • perl5101delta โ€” Perl changes in version 5.10.1
  • perl5100delta โ€” Perl changes in version 5.10.0
  • perl589delta โ€” Perl changes in version 5.8.9
  • perl588delta โ€” Perl changes in version 5.8.8
  • perl587delta โ€” Perl changes in version 5.8.7
  • perl586delta โ€” Perl changes in version 5.8.6
  • perl585delta โ€” Perl changes in version 5.8.5
  • perl584delta โ€” Perl changes in version 5.8.4
  • perl583delta โ€” Perl changes in version 5.8.3
  • perl582delta โ€” Perl changes in version 5.8.2
  • perl581delta โ€” Perl changes in version 5.8.1
  • perl58delta โ€” Perl changes in version 5.8.0
  • perl561delta โ€” Perl changes in version 5.6.1
  • perl56delta โ€” Perl changes in version 5.6
  • perl5005delta โ€” Perl changes in version 5.005
  • perl5004delta โ€” Perl changes in version 5.004

๐ŸŒˆ Miscellaneous ๐ŸŒˆ

the little grab-bag of goodies, no cap ๐Ÿซถ

  • perlbook โ€” Perl book information
  • perlcommunity โ€” Perl community information
  • perldoc โ€” Look up Perl documentation in Pod format
  • perlexperiment โ€” A listing of experimental features in Perl
  • perlartistic โ€” Perl Artistic License
  • perlgpl โ€” GNU General Public License

๐ŸŒธ Language-Specific ๐ŸŒธ

Perl said "i speak your language too bestie" ๐Ÿ’…

  • perlcn โ€” Perl for Simplified Chinese (in UTF-8)
  • perljp โ€” Perl for Japanese (in EUC-JP)
  • perlko โ€” Perl for Korean (in EUC-KR)
  • perltw โ€” Perl for Traditional Chinese (in Big5)

๐Ÿฆ‹ Platform-Specific ๐Ÿฆ‹

every OS gets its own lil love letter, fr fr ๐Ÿ’–

  • perlaix โ€” Perl notes for AIX
  • perlamiga โ€” Perl notes for AmigaOS
  • perlandroid โ€” Perl notes for Android
  • perlbs2000 โ€” Perl notes for POSIX-BC BS2000
  • perlcygwin โ€” Perl notes for Cygwin
  • perlfreebsd โ€” Perl notes for FreeBSD
  • perlhaiku โ€” Perl notes for Haiku
  • perlhpux โ€” Perl notes for HP-UX
  • perlhurd โ€” Perl notes for Hurd
  • perlirix โ€” Perl notes for Irix
  • perllinux โ€” Perl notes for Linux
  • perlmacosx โ€” Perl notes for Mac OS X
  • perlopenbsd โ€” Perl notes for OpenBSD
  • perlos2 โ€” Perl notes for OS/2
  • perlos390 โ€” Perl notes for OS/390
  • perlos400 โ€” Perl notes for OS/400
  • perlplan9 โ€” Perl notes for Plan 9
  • perlqnx โ€” Perl notes for QNX
  • perlriscos โ€” Perl notes for RISC OS
  • perlsolaris โ€” Perl notes for Solaris
  • perlsynology โ€” Perl notes for Synology
  • perltru64 โ€” Perl notes for Tru64
  • perlvms โ€” Perl notes for VMS
  • perlvos โ€” Perl notes for Stratus VOS
  • perlwin32 โ€” Perl notes for Windows

๐Ÿ’€ Stubs for Deleted Documents ๐Ÿ’€

rip to these pages, they're ghosts now, but their names live on ๐Ÿ‘ป

  • perlboot
  • perlbot
  • perlrepository
  • perltodo
  • perltooc
  • perltoot

okay Debian besties, special note for you: you gotta install the perl-doc package, because that's the one holding the majority of the standard Perl documentation and the perldoc program itself. ๐Ÿ’–

and there's SO much more docs out there โ€” extensive additional documentation for Perl modules, both the ones that ship with Perl and third-party modules that are packaged or locally installed. โœจ

you should be able to view all of Perl's documentation with your man(1) program or perldoc(1). ๐Ÿซถ

heads up tho: some documentation is not available as man pages. so if man can't find a cross-reference, try it with perldoc instead. perldoc can also take you straight to documentation for functions (with the -f switch). see perldoc --help (or perldoc perldoc or man perldoc) for the other helpful options perldoc has to offer. ๐Ÿ’…

and like, in general? if something strange has gone wrong with your program and you're not sure where you should even look for help, try making your code comply with use strict and use warnings. these will often point out exactly where the trouble is. it's giving "the compiler is your therapist" ๐Ÿ˜ญ


โœจ DESCRIPTION โœจ

Perl officially stands for Practical Extraction and Report Language, except when it doesn't. ๐Ÿ™ƒ

Perl was originally a language optimized for scanning arbitrary text files, extracting information from those text files, and printing reports based on that information. it quickly became a good language for many system management tasks. over the years, Perl has grown into a general-purpose programming language. it's widely used for everything from quick "one-liners" to full-scale application development. ๐Ÿ”ฅ

the language is intended to be practical (easy to use, efficient, complete) rather than beautiful (tiny, elegant, minimal). it combines (in the author's opinion, anyway) some of the best features of sed, awk, and sh, making it familiar and easy to use for Unix users to whip up quick solutions to annoying problems. its general-purpose programming facilities support procedural, functional, and object-oriented programming paradigms, making Perl a comfortable language for the long haul on major projects, whatever your bent. ๐Ÿ‘‘

Perl's roots in text processing haven't been forgotten over the years. it still boasts some of the most powerful regular expressions to be found anywhere, and its support for Unicode text is world-class. it handles all kinds of structured text too, through an extensive collection of extensions. those libraries, collected in the CPAN, provide ready-made solutions to an astounding array of problems. when they haven't set the standard themselves, they steal from the best โ€” just like Perl itself. ๐Ÿ’–


๐ŸŒ AVAILABILITY ๐ŸŒ

Perl is available for most operating systems, including virtually all Unix-like platforms. see "Supported Platforms" in perlport for a listing. ๐Ÿ—บ๏ธ


๐ŸŒฑ ENVIRONMENT ๐ŸŒฑ

see "ENVIRONMENT" in perlrun.


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Larry Wall <larry@wall.org>, with the help of oodles of other folks. ๐Ÿซถ

if your Perl success stories and testimonials may be of help to others who wish to advocate the use of Perl in their applications, or if you wish to simply express your gratitude to Larry and the Perl developers, please write to perl-thanks@perl.org . ๐Ÿ’Œ


๐Ÿ“ FILES ๐Ÿ“

  • "@INC" โ€” locations of perl libraries

"@INC" above is a reference to the built-in variable of the same name; see perlvar for more information. โœจ


๐ŸŽ€ SEE ALSO ๐ŸŽ€

๐Ÿฉบ DIAGNOSTICS ๐Ÿฉบ

Okay bestie, listen โ€” the use strict pragma is literally the friend who makes sure every single variable is properly declared, and it also blocks all those other sneaky misuses of legacy Perl features. And guess what? It's enabled by default inside the scope of use v5.12 (or higher). So if you're on a modern version you already have it. Iconic behavior.

The use warnings pragma gives you the most lovely diagnostics โ€” genuinely, they're a gift. It's enabled by default when you say use v5.35 (or higher). You could also use the -w flag, but ngl its use is normally discouraged, because it gets applied to all executed Perl code, including code that is not under your control. ๐Ÿ™ˆ Not the vibe.

See perldiag for explanations of all of Perl's diagnostics โ€” that's your glossary, your study guide, your bestie. And the use diagnostics pragma will automatically turn Perl's normally terse warnings and errors into those longer, chattier forms. โœจ

Compilation errors will tell you the line number of the error, along with an indication of the next token or token type that was to be examined. (Sneaky detail: in a script passed to Perl via -e switches, each -e is counted as one line.) ๐Ÿ’…

Setuid scripts have additional constraints that can produce error messages such as "Insecure dependency". See perlsec for the whole saga.

And did we mention that you should definitely consider using the use warnings pragma? Because you should. Consider it. Considered? Good. ๐Ÿซถ


๐Ÿ› BUGS ๐Ÿ›

The behavior implied by the use warnings pragma is not mandatory. Yeah. We know. ๐Ÿ˜ญ

Perl is at the mercy of your machine's definitions of various operations such as type casting, atof(), and floating-point output with sprintf(). It's giving "not my fault, blame the hardware." ๐Ÿ’€

If your stdio requires a seek or eof between reads and writes on a particular stream, then so does Perl. (This doesn't apply to sysread() and syswrite(), those two are exempt, slay.)

While none of the built-in data types have any arbitrary size limits (apart from memory size, obviously, memory is memory), there are still a few arbitrary limits lurking:

  • a given variable name may not be longer than 251 characters โ€” so maybe chill on the descriptive names, queen
  • line numbers displayed by diagnostics are internally stored as short integers, so they're limited to a maximum of 65535 (higher numbers usually being affected by wraparound โ€” yes, wraparound, the chaos)

You may submit your bug reports to:

<https://github.com/Perl/perl5/issues>

Be sure to include full configuration information as output by the myconfig program in the perl source tree, or by perl -V. Full receipts, always. ๐Ÿงพ

And fun fact: Perl actually stands for Pathologically Eclectic Rubbish Lister, but don't tell anyone I said that. ๐Ÿคซ


๐Ÿ“ NOTES ๐Ÿ“

The Perl motto is:

"There's more than one way to do it."

Divining how many more is left as an exercise to the reader. ๐Ÿ˜Œ (It's a lot. It's so many. Good luck.)

The three principal virtues of a programmer are Laziness, Impatience, and Hubris. See the Camel Book for why โ€” that's a whole other rabbit hole, iykyk. ๐Ÿช๐Ÿ“š


And that's the whole page, bestie!! You made it to the very end, which is honestly main character energy. This was perl version v5.40.1, dated 2025-09-11 โ€” go forth, write some wildly eclectic code, and remember: always use warnings. ๐Ÿ’–โœจ๐ŸŽ€๐Ÿฆ‹๐Ÿ’…

๐Ÿ“ฆ where this page comes from