1PERL(1)                Perl Programmers Reference Guide                PERL(1)
2
3
4

NAME

6       perl - The Perl language interpreter
7

SYNOPSIS

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

GETTING HELP

18       The perldoc program gives you access to all the documentation that
19       comes with Perl.  You can get more documentation, tutorials and
20       community support online at <http://www.perl.org/>.
21
22       If you're new to Perl, you should start by running "perldoc perlintro",
23       which is a general intro for beginners and provides some background to
24       help you navigate the rest of Perl's extensive documentation.  Run
25       "perldoc perldoc" to learn more things you can do with perldoc.
26
27       For ease of access, the Perl manual has been split up into several
28       sections.
29
30   Overview
31           perl                Perl overview (this section)
32           perlintro           Perl introduction for beginners
33           perltoc             Perl documentation table of contents
34
35   Tutorials
36           perlreftut          Perl references short introduction
37           perldsc             Perl data structures intro
38           perllol             Perl data structures: arrays of arrays
39
40           perlrequick         Perl regular expressions quick start
41           perlretut           Perl regular expressions tutorial
42
43           perlboot            Perl OO tutorial for beginners
44           perltoot            Perl OO tutorial, part 1
45           perltooc            Perl OO tutorial, part 2
46           perlbot             Perl OO tricks and examples
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           perlrun             Perl execution and options
78           perldiag            Perl diagnostic messages
79           perllexwarn         Perl warnings and their control
80           perldebug           Perl debugging
81           perlvar             Perl predefined variables
82           perlre              Perl regular expressions, the rest of the story
83           perlrebackslash     Perl regular expression backslash sequences
84           perlrecharclass     Perl regular expression character classes
85           perlreref           Perl regular expressions quick reference
86           perlref             Perl references, the rest of the story
87           perlform            Perl formats
88           perlobj             Perl objects
89           perltie             Perl objects hidden behind simple variables
90             perldbmfilter     Perl DBM filters
91
92           perlipc             Perl interprocess communication
93           perlfork            Perl fork() information
94           perlnumber          Perl number semantics
95
96           perlthrtut          Perl threads tutorial
97
98           perlport            Perl portability guide
99           perllocale          Perl locale support
100           perluniintro        Perl Unicode introduction
101           perlunicode         Perl Unicode support
102           perlunifaq          Perl Unicode FAQ
103           perluniprops        Index of Unicode Version 5.2.0 properties in Perl
104           perlunitut          Perl Unicode tutorial
105           perlebcdic          Considerations for running Perl on EBCDIC platforms
106
107           perlsec             Perl security
108
109           perlmod             Perl modules: how they work
110           perlmodlib          Perl modules: how to write and use
111           perlmodstyle        Perl modules: how to write modules with style
112           perlmodinstall      Perl modules: how to install from CPAN
113           perlnewmod          Perl modules: preparing a new module for distribution
114           perlpragma          Perl modules: writing a user pragma
115
116           perlutil            utilities packaged with the Perl distribution
117
118           perlcompile         Perl compiler suite intro
119
120           perlfilter          Perl source filters
121
122           perlglossary        Perl Glossary
123
124   Internals and C Language Interface
125           perlembed           Perl ways to embed perl in your C or C++ application
126           perldebguts         Perl debugging guts and tips
127           perlxstut           Perl XS tutorial
128           perlxs              Perl XS application programming interface
129           perlclib            Internal replacements for standard C library functions
130           perlguts            Perl internal functions for those doing extensions
131           perlcall            Perl calling conventions from C
132           perlmroapi          Perl method resolution plugin interface
133           perlreapi           Perl regular expression plugin interface
134           perlreguts          Perl regular expression engine internals
135
136           perlapi             Perl API listing (autogenerated)
137           perlintern          Perl internal functions (autogenerated)
138           perliol             C API for Perl's implementation of IO in Layers
139           perlapio            Perl internal IO abstraction interface
140
141           perlhack            Perl hackers guide
142           perlpolicy          Perl development policies
143           perlrepository      Perl source repository
144
145   Miscellaneous
146           perlbook            Perl book information
147           perlcommunity       Perl community information
148           perltodo            Perl things to do
149
150           perldoc             Look up Perl documentation in Pod format
151
152           perlhist            Perl history records
153           perldelta           Perl changes since previous version
154           perl5123delta       Perl changes in version 5.12.3
155           perl5122delta       Perl changes in version 5.12.2
156           perl5121delta       Perl changes in version 5.12.1
157           perl5120delta       Perl changes in version 5.12.0
158           perl5115delta       Perl changes in version 5.11.5
159           perl5114delta       Perl changes in version 5.11.4
160           perl5113delta       Perl changes in version 5.11.3
161           perl5112delta       Perl changes in version 5.11.2
162           perl5111delta       Perl changes in version 5.11.1
163           perl5110delta       Perl changes in version 5.11.0
164           perl5101delta       Perl changes in version 5.10.1
165           perl5100delta       Perl changes in version 5.10.0
166           perl595delta        Perl changes in version 5.9.5
167           perl594delta        Perl changes in version 5.9.4
168           perl593delta        Perl changes in version 5.9.3
169           perl592delta        Perl changes in version 5.9.2
170           perl591delta        Perl changes in version 5.9.1
171           perl590delta        Perl changes in version 5.9.0
172           perl589delta        Perl changes in version 5.8.9
173           perl588delta        Perl changes in version 5.8.8
174           perl587delta        Perl changes in version 5.8.7
175           perl586delta        Perl changes in version 5.8.6
176           perl585delta        Perl changes in version 5.8.5
177           perl584delta        Perl changes in version 5.8.4
178           perl583delta        Perl changes in version 5.8.3
179           perl582delta        Perl changes in version 5.8.2
180           perl581delta        Perl changes in version 5.8.1
181           perl58delta         Perl changes in version 5.8.0
182           perl573delta        Perl changes in version 5.7.3
183           perl572delta        Perl changes in version 5.7.2
184           perl571delta        Perl changes in version 5.7.1
185           perl570delta        Perl changes in version 5.7.0
186           perl561delta        Perl changes in version 5.6.1
187           perl56delta         Perl changes in version 5.6
188           perl5005delta       Perl changes in version 5.005
189           perl5004delta       Perl changes in version 5.004
190
191           perlartistic        Perl Artistic License
192           perlgpl             GNU General Public License
193
194   Language-Specific
195           perlcn              Perl for Simplified Chinese (in EUC-CN)
196           perljp              Perl for Japanese (in EUC-JP)
197           perlko              Perl for Korean (in EUC-KR)
198           perltw              Perl for Traditional Chinese (in Big5)
199
200   Platform-Specific
201           perlaix             Perl notes for AIX
202           perlamiga           Perl notes for AmigaOS
203           perlapollo          Perl notes for Apollo DomainOS
204           perlbeos            Perl notes for BeOS
205           perlbs2000          Perl notes for POSIX-BC BS2000
206           perlce              Perl notes for WinCE
207           perlcygwin          Perl notes for Cygwin
208           perldgux            Perl notes for DG/UX
209           perldos             Perl notes for DOS
210           perlepoc            Perl notes for EPOC
211           perlfreebsd         Perl notes for FreeBSD
212           perlhaiku           Perl notes for Haiku
213           perlhpux            Perl notes for HP-UX
214           perlhurd            Perl notes for Hurd
215           perlirix            Perl notes for Irix
216           perllinux           Perl notes for Linux
217           perlmacos           Perl notes for Mac OS (Classic)
218           perlmacosx          Perl notes for Mac OS X
219           perlmpeix           Perl notes for MPE/iX
220           perlnetware         Perl notes for NetWare
221           perlopenbsd         Perl notes for OpenBSD
222           perlos2             Perl notes for OS/2
223           perlos390           Perl notes for OS/390
224           perlos400           Perl notes for OS/400
225           perlplan9           Perl notes for Plan 9
226           perlqnx             Perl notes for QNX
227           perlriscos          Perl notes for RISC OS
228           perlsolaris         Perl notes for Solaris
229           perlsymbian         Perl notes for Symbian
230           perltru64           Perl notes for Tru64
231           perluts             Perl notes for UTS
232           perlvmesa           Perl notes for VM/ESA
233           perlvms             Perl notes for VMS
234           perlvos             Perl notes for Stratus VOS
235           perlwin32           Perl notes for Windows
236
237       On a Unix-like system, these documentation files will usually also be
238       available as manpages for use with the man program.
239
240       In general, if something strange has gone wrong with your program and
241       you're not sure where you should look for help, try the -w switch
242       first.  It will often point out exactly where the trouble is.
243

DESCRIPTION

245       Perl officially stands for Practical Extraction and Report Language,
246       except when it doesn't.
247
248       Perl is a language optimized for scanning arbitrary text files,
249       extracting information from those text files, and printing reports
250       based on that information.  It's also a good language for many system
251       management tasks.  The language is intended to be practical (easy to
252       use, efficient, complete) rather than beautiful (tiny, elegant,
253       minimal).
254
255       Perl combines (in the author's opinion, anyway) some of the best
256       features of C, sed, awk, and sh, so people familiar with those
257       languages should have little difficulty with it.  (Language historians
258       will also note some vestiges of csh, Pascal, and even BASIC-PLUS.)
259       Expression syntax corresponds closely to C expression syntax.  Unlike
260       most Unix utilities, Perl does not arbitrarily limit the size of your
261       data--if you've got the memory, Perl can slurp in your whole file as a
262       single string.  Recursion is of unlimited depth.  And the tables used
263       by hashes (sometimes called "associative arrays") grow as necessary to
264       prevent degraded performance.  Perl can use sophisticated pattern
265       matching techniques to scan large amounts of data quickly.  Although
266       optimized for scanning text, Perl can also deal with binary data, and
267       can make dbm files look like hashes.  Setuid Perl scripts are safer
268       than C programs through a dataflow tracing mechanism that prevents many
269       stupid security holes.
270
271       If you have a problem that would ordinarily use sed or awk or sh, but
272       it exceeds their capabilities or must run a little faster, and you
273       don't want to write the silly thing in C, then Perl may be for you.
274       There are also translators to turn your sed and awk scripts into Perl
275       scripts.
276
277       But wait, there's more...
278
279       Begun in 1993 (see perlhist), Perl version 5 is nearly a complete
280       rewrite that provides the following additional benefits:
281
282       ·   modularity and reusability using innumerable modules
283
284           Described in perlmod, perlmodlib, and perlmodinstall.
285
286       ·   embeddable and extensible
287
288           Described in perlembed, perlxstut, perlxs, perlcall, perlguts, and
289           xsubpp.
290
291       ·   roll-your-own magic variables (including multiple simultaneous DBM
292           implementations)
293
294           Described in perltie and AnyDBM_File.
295
296       ·   subroutines can now be overridden, autoloaded, and prototyped
297
298           Described in perlsub.
299
300       ·   arbitrarily nested data structures and anonymous functions
301
302           Described in perlreftut, perlref, perldsc, and perllol.
303
304       ·   object-oriented programming
305
306           Described in perlobj, perlboot, perltoot, perltooc, and perlbot.
307
308       ·   support for light-weight processes (threads)
309
310           Described in perlthrtut and threads.
311
312       ·   support for Unicode, internationalization, and localization
313
314           Described in perluniintro, perllocale and Locale::Maketext.
315
316       ·   lexical scoping
317
318           Described in perlsub.
319
320       ·   regular expression enhancements
321
322           Described in perlre, with additional examples in perlop.
323
324       ·   enhanced debugger and interactive Perl environment, with integrated
325           editor support
326
327           Described in perldebtut, perldebug and perldebguts.
328
329       ·   POSIX 1003.1 compliant library
330
331           Described in POSIX.
332
333       Okay, that's definitely enough hype.
334

AVAILABILITY

336       Perl is available for most operating systems, including virtually all
337       Unix-like platforms.  See "Supported Platforms" in perlport for a
338       listing.
339

ENVIRONMENT

341       See perlrun.
342

AUTHOR

344       Larry Wall <larry@wall.org>, with the help of oodles of other folks.
345
346       If your Perl success stories and testimonials may be of help to others
347       who wish to advocate the use of Perl in their applications, or if you
348       wish to simply express your gratitude to Larry and the Perl developers,
349       please write to perl-thanks@perl.org .
350

FILES

352        "@INC"                 locations of perl libraries
353

SEE ALSO

355        a2p    awk to perl translator
356        s2p    sed to perl translator
357
358        http://www.perl.org/       the Perl homepage
359        http://www.perl.com/       Perl articles (O'Reilly)
360        http://www.cpan.org/       the Comprehensive Perl Archive
361        http://www.pm.org/         the Perl Mongers
362

DIAGNOSTICS

364       The "use warnings" pragma (and the -w switch) produces some lovely
365       diagnostics.
366
367       See perldiag for explanations of all Perl's diagnostics.  The "use
368       diagnostics" pragma automatically turns Perl's normally terse warnings
369       and errors into these longer forms.
370
371       Compilation errors will tell you the line number of the error, with an
372       indication of the next token or token type that was to be examined.
373       (In a script passed to Perl via -e switches, each -e is counted as one
374       line.)
375
376       Setuid scripts have additional constraints that can produce error
377       messages such as "Insecure dependency".  See perlsec.
378
379       Did we mention that you should definitely consider using the -w switch?
380

BUGS

382       The -w switch is not mandatory.
383
384       Perl is at the mercy of your machine's definitions of various
385       operations such as type casting, atof(), and floating-point output with
386       sprintf().
387
388       If your stdio requires a seek or eof between reads and writes on a
389       particular stream, so does Perl.  (This doesn't apply to sysread() and
390       syswrite().)
391
392       While none of the built-in data types have any arbitrary size limits
393       (apart from memory size), there are still a few arbitrary limits:  a
394       given variable name may not be longer than 251 characters.  Line
395       numbers displayed by diagnostics are internally stored as short
396       integers, so they are limited to a maximum of 65535 (higher numbers
397       usually being affected by wraparound).
398
399       You may mail your bug reports (be sure to include full configuration
400       information as output by the myconfig program in the perl source tree,
401       or by "perl -V") to perlbug@perl.org .  If you've succeeded in
402       compiling perl, the perlbug script in the utils/ subdirectory can be
403       used to help mail in a bug report.
404
405       Perl actually stands for Pathologically Eclectic Rubbish Lister, but
406       don't tell anyone I said that.
407

NOTES

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.12.4                      2011-06-10                           PERL(1)
Impressum