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