Debian Codegraph @

upstream/fedora-rawhide/man1/perl.1

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\"
56 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "PERL 1"
61 .TH PERL 1 2026-03-30 "perl v5.42.2" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 perl \- The Perl 5 language interpreter
68 .SH SYNOPSIS
69 .IX Header "SYNOPSIS"
70 \&\fBperl\fR [\ \fB\-sTtuUWX\fR\ ]
71 [\ \fB\-hv\fR\ ]\ [\ \fB\-V\fR[:\fIconfigvar\fR]\ ]
72 [\ \fB\-cw\fR\ ]\ [\ \fB\-d\fR[\fBt\fR][:\fIdebugger\fR]\ ]\ [\ \fB\-D\fR[\fInumber/list\fR]\ ]
73 [\ \fB\-pna\fR\ ]\ [\ \fB\-F\fR\fIpattern\fR\ ]\ [\ \fB\-l\fR[\fIoctal\fR]\ ]\ [\ \fB\-0\fR[\fIoctal/hexadecimal\fR]\ ]
74 [\ \fB\-I\fR\fIdir\fR\ ]\ [\ \fB\-m\fR[\fB\-\fR]\fImodule\fR\ ]\ [\ \fB\-M\fR[\fB\-\fR]\fI\*(Aqmodule...\*(Aq\fR\ ]\ [\ \fB\-f\fR\ ]
75 [\ \fB\-C\ [\fR\f(BInumber/list\fR\fB]\ \fR]
76 [\ \fB\-S\fR\ ]
77 [\ \fB\-x\fR[\fIdir\fR]\ ]
78 [\ \fB\-i\fR[\fIextension\fR]\ ]
79 [\ [\fB\-e\fR|\fB\-E\fR]\ \fI\*(Aqcommand\*(Aq\fR\ ]\ [\ \fB\-\-\fR\ ]\ [\ \fIprogramfile\fR\ ]\ [\ \fIargument\fR\ ]...
80 .PP
81 For more information on these options, you can run \f(CW\*(C`perldoc perlrun\*(C'\fR.
82 .SH "GETTING HELP"
83 .IX Header "GETTING HELP"
84 The \fIperldoc\fR program gives you access to all the documentation that comes
85 with Perl. You can get more documentation, tutorials and community support
86 online at <https://www.perl.org/>.
87 .PP
88 If you\*(Aqre new to Perl, you should start by running \f(CW\*(C`perldoc perlintro\*(C'\fR,
89 which is a general intro for beginners and provides some background to help
90 you navigate the rest of Perl\*(Aqs extensive documentation. Run \f(CW\*(C`perldoc
91 perldoc\*(C'\fR to learn more things you can do with \fIperldoc\fR.
92 .PP
93 For ease of access, the Perl manual has been split up into several sections.
94 .SS Overview
95 .IX Subsection "Overview"
96 .Vb 4
97 \& perl Perl overview (this section)
98 \& perlintro Perl introduction for beginners
99 \& perlrun Perl execution and options
100 \& perltoc Perl documentation table of contents
101 .Ve
102 .SS Tutorials
103 .IX Subsection "Tutorials"
104 .Vb 3
105 \& perlreftut Perl references short introduction
106 \& perldsc Perl data structures intro
107 \& perllol Perl data structures: arrays of arrays
108 \&
109 \& perlrequick Perl regular expressions quick start
110 \& perlretut Perl regular expressions tutorial
111 \&
112 \& perlootut Perl OO tutorial for beginners
113 \&
114 \& perlperf Perl Performance and Optimization Techniques
115 \&
116 \& perlstyle Perl style guide
117 \&
118 \& perlcheat Perl cheat sheet
119 \& perltrap Perl traps for the unwary
120 \& perldebtut Perl debugging tutorial
121 \&
122 \& perlfaq Perl frequently asked questions
123 \& perlfaq1 General Questions About Perl
124 \& perlfaq2 Obtaining and Learning about Perl
125 \& perlfaq3 Programming Tools
126 \& perlfaq4 Data Manipulation
127 \& perlfaq5 Files and Formats
128 \& perlfaq6 Regexes
129 \& perlfaq7 Perl Language Issues
130 \& perlfaq8 System Interaction
131 \& perlfaq9 Networking
132 .Ve
133 .SS "Reference Manual"
134 .IX Subsection "Reference Manual"
135 .Vb 10
136 \& perlsyn Perl syntax: declarations, statements, comments
137 \& perldata Perl data structures
138 \& perlop Perl expressions: operators, precedence, string literals
139 \& perlsub Perl subroutines
140 \& perlfunc Perl built\-in functions
141 \& perlopentut Perl open() tutorial
142 \& perlpacktut Perl pack() and unpack() tutorial
143 \& perlpod Perl plain old documentation
144 \& perlpodspec Perl plain old documentation format specification
145 \& perldocstyle Perl style guide for core docs
146 \& perlpodstyle Perl POD style guide
147 \& perldiag Perl diagnostic messages
148 \& perldeprecation Perl deprecations
149 \& perllexwarn Perl warnings and their control
150 \& perldebug Perl debugging
151 \& perlvar Perl predefined variables
152 \& perlre Perl regular expressions, the rest of the story
153 \& perlrebackslash Perl regular expression backslash sequences
154 \& perlrecharclass Perl regular expression character classes
155 \& perlreref Perl regular expressions quick reference
156 \& perlref Perl references, the rest of the story
157 \& perlform Perl formats
158 \& perlobj Perl objects
159 \& perltie Perl objects hidden behind simple variables
160 \& perldbmfilter Perl DBM filters
161 \& perlclass Perl class syntax
162 \&
163 \& perlipc Perl interprocess communication
164 \& perlfork Perl fork() information
165 \& perlnumber Perl number semantics
166 \&
167 \& perlthrtut Perl threads tutorial
168 \&
169 \& perlport Perl portability guide
170 \& perllocale Perl locale support
171 \& perluniintro Perl Unicode introduction
172 \& perlunicode Perl Unicode support
173 \& perlunicook Perl Unicode cookbook
174 \& perlunifaq Perl Unicode FAQ
175 \& perluniprops Index of Unicode properties in Perl
176 \& perlunitut Perl Unicode tutorial
177 \& perlebcdic Considerations for running Perl on EBCDIC platforms
178 \&
179 \& perlsec Perl security
180 \& perlsecpolicy Perl security report handling policy
181 \&
182 \& perlmod Perl modules: how they work
183 \& perlmodlib Perl modules: how to write and use
184 \& perlmodstyle Perl modules: how to write modules with style
185 \& perlmodinstall Perl modules: how to install from CPAN
186 \& perlnewmod Perl modules: preparing a new module for distribution
187 \& perlpragma Perl modules: writing a user pragma
188 \&
189 \& perlutil utilities packaged with the Perl distribution
190 \&
191 \& perlfilter Perl source filters
192 \&
193 \& perldtrace Perl\*(Aqs support for DTrace
194 \&
195 \& perlglossary Perl Glossary
196 .Ve
197 .SS "Internals and C Language Interface"
198 .IX Subsection "Internals and C Language Interface"
199 .Vb 12
200 \& perlembed Perl ways to embed perl in your C or C++ application
201 \& perldebguts Perl debugging guts and tips
202 \& perlxstut Perl XS tutorial
203 \& perlxs Perl XS application programming interface
204 \& perlxstypemap Perl XS C/Perl type conversion tools
205 \& perlclib Interacting with standard C library functions
206 \& perlguts Perl internal functions for those doing extensions
207 \& perlcall Perl calling conventions from C
208 \& perlmroapi Perl method resolution plugin interface
209 \& perlreapi Perl regular expression plugin interface
210 \& perlreguts Perl regular expression engine internals
211 \& perlclassguts Internals of class syntax
212 \&
213 \& perlapi Perl API listing (autogenerated)
214 \& perlintern Perl internal functions (autogenerated)
215 \& perliol C API for Perl\*(Aqs implementation of IO in Layers
216 \& perlapio Perl internal IO abstraction interface
217 \&
218 \& perlhack Perl hackers guide
219 \& perlsource Guide to the Perl source tree
220 \& perlinterp Overview of the Perl interpreter source and how it works
221 \& perlhacktut Walk through the creation of a simple C code patch
222 \& perlhacktips Tips for Perl core C code hacking
223 \& perlpolicy Perl development policies
224 \& perlgov Perl Rules of Governance
225 \& perlgit Using git with the Perl repository
226 .Ve
227 .SS History
228 .IX Subsection "History"
229 .Vb 10
230 \& perlhist Perl history records
231 \& perldelta Perl changes since previous version
232 \& perl5421delta Perl changes in version 5.42.1
233 \& perl5420delta Perl changes in version 5.42.0
234 \& perl5403delta Perl changes in version 5.40.3
235 \& perl5402delta Perl changes in version 5.40.2
236 \& perl5401delta Perl changes in version 5.40.1
237 \& perl5400delta Perl changes in version 5.40.0
238 \& perl5385delta Perl changes in version 5.38.5
239 \& perl5384delta Perl changes in version 5.38.4
240 \& perl5383delta Perl changes in version 5.38.3
241 \& perl5382delta Perl changes in version 5.38.2
242 \& perl5381delta Perl changes in version 5.38.1
243 \& perl5380delta Perl changes in version 5.38.0
244 \& perl5363delta Perl changes in version 5.36.3
245 \& perl5362delta Perl changes in version 5.36.2
246 \& perl5361delta Perl changes in version 5.36.1
247 \& perl5360delta Perl changes in version 5.36.0
248 \& perl5343delta Perl changes in version 5.34.3
249 \& perl5342delta Perl changes in version 5.34.2
250 \& perl5341delta Perl changes in version 5.34.1
251 \& perl5340delta Perl changes in version 5.34.0
252 \& perl5321delta Perl changes in version 5.32.1
253 \& perl5320delta Perl changes in version 5.32.0
254 \& perl5303delta Perl changes in version 5.30.3
255 \& perl5302delta Perl changes in version 5.30.2
256 \& perl5301delta Perl changes in version 5.30.1
257 \& perl5300delta Perl changes in version 5.30.0
258 \& perl5283delta Perl changes in version 5.28.3
259 \& perl5282delta Perl changes in version 5.28.2
260 \& perl5281delta Perl changes in version 5.28.1
261 \& perl5280delta Perl changes in version 5.28.0
262 \& perl5263delta Perl changes in version 5.26.3
263 \& perl5262delta Perl changes in version 5.26.2
264 \& perl5261delta Perl changes in version 5.26.1
265 \& perl5260delta Perl changes in version 5.26.0
266 \& perl5244delta Perl changes in version 5.24.4
267 \& perl5243delta Perl changes in version 5.24.3
268 \& perl5242delta Perl changes in version 5.24.2
269 \& perl5241delta Perl changes in version 5.24.1
270 \& perl5240delta Perl changes in version 5.24.0
271 \& perl5224delta Perl changes in version 5.22.4
272 \& perl5223delta Perl changes in version 5.22.3
273 \& perl5222delta Perl changes in version 5.22.2
274 \& perl5221delta Perl changes in version 5.22.1
275 \& perl5220delta Perl changes in version 5.22.0
276 \& perl5203delta Perl changes in version 5.20.3
277 \& perl5202delta Perl changes in version 5.20.2
278 \& perl5201delta Perl changes in version 5.20.1
279 \& perl5200delta Perl changes in version 5.20.0
280 \& perl5184delta Perl changes in version 5.18.4
281 \& perl5182delta Perl changes in version 5.18.2
282 \& perl5181delta Perl changes in version 5.18.1
283 \& perl5180delta Perl changes in version 5.18.0
284 \& perl5163delta Perl changes in version 5.16.3
285 \& perl5162delta Perl changes in version 5.16.2
286 \& perl5161delta Perl changes in version 5.16.1
287 \& perl5160delta Perl changes in version 5.16.0
288 \& perl5144delta Perl changes in version 5.14.4
289 \& perl5143delta Perl changes in version 5.14.3
290 \& perl5142delta Perl changes in version 5.14.2
291 \& perl5141delta Perl changes in version 5.14.1
292 \& perl5140delta Perl changes in version 5.14.0
293 \& perl5125delta Perl changes in version 5.12.5
294 \& perl5124delta Perl changes in version 5.12.4
295 \& perl5123delta Perl changes in version 5.12.3
296 \& perl5122delta Perl changes in version 5.12.2
297 \& perl5121delta Perl changes in version 5.12.1
298 \& perl5120delta Perl changes in version 5.12.0
299 \& perl5101delta Perl changes in version 5.10.1
300 \& perl5100delta Perl changes in version 5.10.0
301 \& perl589delta Perl changes in version 5.8.9
302 \& perl588delta Perl changes in version 5.8.8
303 \& perl587delta Perl changes in version 5.8.7
304 \& perl586delta Perl changes in version 5.8.6
305 \& perl585delta Perl changes in version 5.8.5
306 \& perl584delta Perl changes in version 5.8.4
307 \& perl583delta Perl changes in version 5.8.3
308 \& perl582delta Perl changes in version 5.8.2
309 \& perl581delta Perl changes in version 5.8.1
310 \& perl58delta Perl changes in version 5.8.0
311 \& perl561delta Perl changes in version 5.6.1
312 \& perl56delta Perl changes in version 5.6
313 \& perl5005delta Perl changes in version 5.005
314 \& perl5004delta Perl changes in version 5.004
315 .Ve
316 .SS Miscellaneous
317 .IX Subsection "Miscellaneous"
318 .Vb 2
319 \& perlbook Perl book information
320 \& perlcommunity Perl community information
321 \&
322 \& perldoc Look up Perl documentation in Pod format
323 \&
324 \& perlexperiment A listing of experimental features in Perl
325 \&
326 \& perlartistic Perl Artistic License
327 \& perlgpl GNU General Public License
328 .Ve
329 .SS Language\-Specific
330 .IX Subsection "Language-Specific"
331 .Vb 4
332 \& perlcn Perl for Simplified Chinese (in UTF\-8)
333 \& perljp Perl for Japanese (in EUC\-JP)
334 \& perlko Perl for Korean (in EUC\-KR)
335 \& perltw Perl for Traditional Chinese (in Big5)
336 .Ve
337 .SS Platform\-Specific
338 .IX Subsection "Platform-Specific"
339 .Vb 10
340 \& perlaix Perl notes for AIX
341 \& perlamiga Perl notes for AmigaOS
342 \& perlandroid Perl notes for Android
343 \& perlbs2000 Perl notes for POSIX\-BC BS2000
344 \& perlcygwin Perl notes for Cygwin
345 \& perlfreebsd Perl notes for FreeBSD
346 \& perlhaiku Perl notes for Haiku
347 \& perlhpux Perl notes for HP\-UX
348 \& perlhurd Perl notes for Hurd
349 \& perlirix Perl notes for Irix
350 \& perllinux Perl notes for Linux
351 \& perlmacosx Perl notes for Mac OS X
352 \& perlopenbsd Perl notes for OpenBSD
353 \& perlos2 Perl notes for OS/2
354 \& perlos390 Perl notes for OS/390
355 \& perlos400 Perl notes for OS/400
356 \& perlplan9 Perl notes for Plan 9
357 \& perlqnx Perl notes for QNX
358 \& perlriscos Perl notes for RISC OS
359 \& perlsolaris Perl notes for Solaris
360 \& perlsynology Perl notes for Synology
361 \& perltru64 Perl notes for Tru64
362 \& perlvms Perl notes for VMS
363 \& perlvos Perl notes for Stratus VOS
364 \& perlwin32 Perl notes for Windows
365 .Ve
366 .SS "Stubs for Deleted Documents"
367 .IX Subsection "Stubs for Deleted Documents"
368 .Vb 6
369 \& perlboot
370 \& perlbot
371 \& perlrepository
372 \& perltodo
373 \& perltooc
374 \& perltoot
375 .Ve
376 .PP
377 On a Unix\-like system, these documentation files will usually also be
378 available as manpages for use with the \fIman\fR program.
379 .PP
380 Some documentation is not available as man pages, so if a
381 cross\-reference is not found by man, try it with perldoc. Perldoc can
382 also take you directly to documentation for functions (with the \fB\-f\fR
383 switch). See \f(CW\*(C`perldoc\ \-\-help\*(C'\fR (or \f(CW\*(C`perldoc\ perldoc\*(C'\fR or
384 \&\f(CW\*(C`man\ perldoc\*(C'\fR) for other helpful options perldoc has to offer.
385 .PP
386 In general, if something strange has gone wrong with your program and you\*(Aqre
387 not sure where you should look for help, try making your code comply with
388 \&\fBuse strict\fR and \fBuse warnings\fR. These will often point out exactly
389 where the trouble is.
390 .SH DESCRIPTION
391 .IX Header "DESCRIPTION"
392 Perl officially stands for Practical Extraction and Report Language,
393 except when it doesn\*(Aqt.
394 .PP
395 Perl was originally a language optimized for scanning arbitrary
396 text files, extracting information from those text files, and printing
397 reports based on that information. It quickly became a good language
398 for many system management tasks. Over the years, Perl has grown into
399 a general\-purpose programming language. It\*(Aqs widely used for everything
400 from quick "one\-liners" to full\-scale application development.
401 .PP
402 The language is intended to be practical (easy to use, efficient,
403 complete) rather than beautiful (tiny, elegant, minimal). It combines
404 (in the author\*(Aqs opinion, anyway) some of the best features of \fBsed\fR,
405 \&\fBawk\fR, and \fBsh\fR, making it familiar and easy to use for Unix users to
406 whip up quick solutions to annoying problems. Its general\-purpose
407 programming facilities support procedural, functional, and
408 object\-oriented programming paradigms, making Perl a comfortable
409 language for the long haul on major projects, whatever your bent.
410 .PP
411 Perl\*(Aqs roots in text processing haven\*(Aqt been forgotten over the years.
412 It still boasts some of the most powerful regular expressions to be
413 found anywhere, and its support for Unicode text is world\-class. It
414 handles all kinds of structured text, too, through an extensive
415 collection of extensions. Those libraries, collected in the CPAN,
416 provide ready\-made solutions to an astounding array of problems. When
417 they haven\*(Aqt set the standard themselves, they steal from the best
418 \&\-\- just like Perl itself.
419 .SH AVAILABILITY
420 .IX Header "AVAILABILITY"
421 Perl is available for most operating systems, including virtually
422 all Unix\-like platforms. See "Supported Platforms" in perlport
423 for a listing.
424 .SH ENVIRONMENT
425 .IX Header "ENVIRONMENT"
426 See "ENVIRONMENT" in perlrun.
427 .SH AUTHOR
428 .IX Header "AUTHOR"
429 Larry Wall <[email protected]>, with the help of oodles of other folks.
430 .PP
431 If your Perl success stories and testimonials may be of help to others
432 who wish to advocate the use of Perl in their applications,
433 or if you wish to simply express your gratitude to Larry and the
434 Perl developers, please write to perl\[email protected] .
435 .SH FILES
436 .IX Header "FILES"
437 .Vb 1
438 \& "@INC" locations of perl libraries
439 .Ve
440 .PP
441 "@INC" above is a reference to the built\-in variable of the same name;
442 see perlvar for more information.
443 .SH "SEE ALSO"
444 .IX Header "SEE ALSO"
445 .IP <https://www.perl.org/> 4
446 .IX Item "<https://www.perl.org/>"
447 the Perl homepage
448 .IP <https://www.perl.com/> 4
449 .IX Item "<https://www.perl.com/>"
450 Perl articles
451 .IP <https://www.cpan.org/> 4
452 .IX Item "<https://www.cpan.org/>"
453 the Comprehensive Perl Archive
454 .IP <https://www.pm.org/> 4
455 .IX Item "<https://www.pm.org/>"
456 the Perl Mongers
457 .SH DIAGNOSTICS
458 .IX Header "DIAGNOSTICS"
459 Using the \f(CW\*(C`use strict\*(C'\fR pragma ensures that all variables are properly
460 declared and prevents other misuses of legacy Perl features.
461 These are enabled by default within the scope of
462 \&\f(CW\*(C`use v5.12\*(C'\fR (or higher).
463 .PP
464 The \f(CW\*(C`use warnings\*(C'\fR pragma produces some lovely diagnostics.
465 It is enabled by default when you say \f(CW\*(C`use v5.35\*(C'\fR (or higher).
466 One can also use the \fB\-w\fR flag, but its use is normally discouraged,
467 because it gets applied to all executed Perl code, including that not under
468 your control.
469 .PP
470 See perldiag for explanations of all Perl\*(Aqs diagnostics. The \f(CW\*(C`use
471 diagnostics\*(C'\fR pragma automatically turns Perl\*(Aqs normally terse warnings
472 and errors into these longer forms.
473 .PP
474 Compilation errors will tell you the line number of the error, with an
475 indication of the next token or token type that was to be examined.
476 (In a script passed to Perl via \fB\-e\fR switches, each
477 \&\fB\-e\fR is counted as one line.)
478 .PP
479 Setuid scripts have additional constraints that can produce error
480 messages such as "Insecure dependency". See perlsec.
481 .PP
482 Did we mention that you should definitely consider using the \fBuse warnings\fR
483 pragma?
484 .SH BUGS
485 .IX Header "BUGS"
486 The behavior implied by the \fBuse warnings\fR pragma is not mandatory.
487 .PP
488 Perl is at the mercy of your machine\*(Aqs definitions of various
489 operations such as type casting, \fBatof()\fR, and floating\-point
490 output with \fBsprintf()\fR.
491 .PP
492 If your stdio requires a seek or eof between reads and writes on a
493 particular stream, so does Perl. (This doesn\*(Aqt apply to \fBsysread()\fR
494 and \fBsyswrite()\fR.)
495 .PP
496 While none of the built\-in data types have any arbitrary size limits
497 (apart from memory size), there are still a few arbitrary limits: a
498 given variable name may not be longer than 251 characters. Line numbers
499 displayed by diagnostics are internally stored as short integers,
500 so they are limited to a maximum of 65535 (higher numbers usually being
501 affected by wraparound).
502 .PP
503 You may submit your bug reports (be sure to include full configuration
504 information as output by the myconfig program in the perl source
505 tree, or by \f(CW\*(C`perl \-V\*(C'\fR) to <https://github.com/Perl/perl5/issues>.
506 .PP
507 Perl actually stands for Pathologically Eclectic Rubbish Lister, but
508 don\*(Aqt tell anyone I said that.
509 .SH NOTES
510 .IX Header "NOTES"
511 The Perl motto is "There\*(Aqs more than one way to do it." Divining
512 how many more is left as an exercise to the reader.
513 .PP
514 The three principal virtues of a programmer are Laziness,
515 Impatience, and Hubris. See the Camel Book for why.