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