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

NAME

6       perl - Practical Extraction and Report Language
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] ]      [ -P ]      [ -S ]      [ -x[dir] ]
14            [ -i[extension] ]      [ -e 'command' ] [ -- ] [ program‐
15       file ] [ argument ]...
16
17       If you're new to Perl, you should start with perlintro, which is a gen‐
18       eral intro for beginners and provides some background to help you navi‐
19       gate the rest of Perl's extensive documentation.
20
21       For ease of access, the Perl manual has been split up into several sec‐
22       tions.
23
24       Overview
25
26           perl                Perl overview (this section)
27           perlintro           Perl introduction for beginners
28           perltoc             Perl documentation table of contents
29
30       Tutorials
31
32           perlreftut          Perl references short introduction
33           perldsc             Perl data structures intro
34           perllol             Perl data structures: arrays of arrays
35
36           perlrequick         Perl regular expressions quick start
37           perlretut           Perl regular expressions tutorial
38
39           perlboot            Perl OO tutorial for beginners
40           perltoot            Perl OO tutorial, part 1
41           perltooc            Perl OO tutorial, part 2
42           perlbot             Perl OO tricks and examples
43
44           perlstyle           Perl style guide
45
46           perlcheat           Perl cheat sheet
47           perltrap            Perl traps for the unwary
48           perldebtut          Perl debugging tutorial
49
50           perlfaq             Perl frequently asked questions
51             perlfaq1          General Questions About Perl
52             perlfaq2          Obtaining and Learning about Perl
53             perlfaq3          Programming Tools
54             perlfaq4          Data Manipulation
55             perlfaq5          Files and Formats
56             perlfaq6          Regexes
57             perlfaq7          Perl Language Issues
58             perlfaq8          System Interaction
59             perlfaq9          Networking
60
61       Reference Manual
62
63           perlsyn             Perl syntax
64           perldata            Perl data structures
65           perlop              Perl operators and precedence
66           perlsub             Perl subroutines
67           perlfunc            Perl built-in functions
68             perlopentut       Perl open() tutorial
69             perlpacktut       Perl pack() and unpack() tutorial
70           perlpod             Perl plain old documentation
71           perlpodspec         Perl plain old documentation format specification
72           perlrun             Perl execution and options
73           perldiag            Perl diagnostic messages
74           perllexwarn         Perl warnings and their control
75           perldebug           Perl debugging
76           perlvar             Perl predefined variables
77           perlre              Perl regular expressions, the rest of the story
78           perlreref           Perl regular expressions quick reference
79           perlref             Perl references, the rest of the story
80           perlform            Perl formats
81           perlobj             Perl objects
82           perltie             Perl objects hidden behind simple variables
83             perldbmfilter     Perl DBM filters
84
85           perlipc             Perl interprocess communication
86           perlfork            Perl fork() information
87           perlnumber          Perl number semantics
88
89           perlthrtut          Perl threads tutorial
90             perlothrtut       Old Perl threads tutorial
91
92           perlport            Perl portability guide
93           perllocale          Perl locale support
94           perluniintro        Perl Unicode introduction
95           perlunicode         Perl Unicode support
96           perlebcdic          Considerations for running Perl on EBCDIC platforms
97
98           perlsec             Perl security
99
100           perlmod             Perl modules: how they work
101           perlmodlib          Perl modules: how to write and use
102           perlmodstyle        Perl modules: how to write modules with style
103           perlmodinstall      Perl modules: how to install from CPAN
104           perlnewmod          Perl modules: preparing a new module for distribution
105
106           perlutil            utilities packaged with the Perl distribution
107
108           perlcompile         Perl compiler suite intro
109
110           perlfilter          Perl source filters
111
112           perlglossary        Perl Glossary
113
114       Internals and C Language Interface
115
116           perlembed           Perl ways to embed perl in your C or C++ application
117           perldebguts         Perl debugging guts and tips
118           perlxstut           Perl XS tutorial
119           perlxs              Perl XS application programming interface
120           perlclib            Internal replacements for standard C library functions
121           perlguts            Perl internal functions for those doing extensions
122           perlcall            Perl calling conventions from C
123
124           perlapi             Perl API listing (autogenerated)
125           perlintern          Perl internal functions (autogenerated)
126           perliol             C API for Perl's implementation of IO in Layers
127           perlapio            Perl internal IO abstraction interface
128
129           perlhack            Perl hackers guide
130
131       Miscellaneous
132
133           perlbook            Perl book information
134           perltodo            Perl things to do
135
136           perldoc             Look up Perl documentation in Pod format
137
138           perlhist            Perl history records
139           perldelta           Perl changes since previous version
140           perl587delta        Perl changes in version 5.8.7
141           perl586delta        Perl changes in version 5.8.6
142           perl585delta        Perl changes in version 5.8.5
143           perl584delta        Perl changes in version 5.8.4
144           perl583delta        Perl changes in version 5.8.3
145           perl582delta        Perl changes in version 5.8.2
146           perl581delta        Perl changes in version 5.8.1
147           perl58delta         Perl changes in version 5.8.0
148           perl573delta        Perl changes in version 5.7.3
149           perl572delta        Perl changes in version 5.7.2
150           perl571delta        Perl changes in version 5.7.1
151           perl570delta        Perl changes in version 5.7.0
152           perl561delta        Perl changes in version 5.6.1
153           perl56delta         Perl changes in version 5.6
154           perl5005delta       Perl changes in version 5.005
155           perl5004delta       Perl changes in version 5.004
156
157           perlartistic        Perl Artistic License
158           perlgpl             GNU General Public License
159
160       Language-Specific
161
162           perlcn              Perl for Simplified Chinese (in EUC-CN)
163           perljp              Perl for Japanese (in EUC-JP)
164           perlko              Perl for Korean (in EUC-KR)
165           perltw              Perl for Traditional Chinese (in Big5)
166
167       Platform-Specific
168
169           perlaix             Perl notes for AIX
170           perlamiga           Perl notes for AmigaOS
171           perlapollo          Perl notes for Apollo DomainOS
172           perlbeos            Perl notes for BeOS
173           perlbs2000          Perl notes for POSIX-BC BS2000
174           perlce              Perl notes for WinCE
175           perlcygwin          Perl notes for Cygwin
176           perldgux            Perl notes for DG/UX
177           perldos             Perl notes for DOS
178           perlepoc            Perl notes for EPOC
179           perlfreebsd         Perl notes for FreeBSD
180           perlhpux            Perl notes for HP-UX
181           perlhurd            Perl notes for Hurd
182           perlirix            Perl notes for Irix
183           perllinux           Perl notes for Linux
184           perlmachten         Perl notes for Power MachTen
185           perlmacos           Perl notes for Mac OS (Classic)
186           perlmacosx          Perl notes for Mac OS X
187           perlmint            Perl notes for MiNT
188           perlmpeix           Perl notes for MPE/iX
189           perlnetware         Perl notes for NetWare
190           perlopenbsd         Perl notes for OpenBSD
191           perlos2             Perl notes for OS/2
192           perlos390           Perl notes for OS/390
193           perlos400           Perl notes for OS/400
194           perlplan9           Perl notes for Plan 9
195           perlqnx             Perl notes for QNX
196           perlsolaris         Perl notes for Solaris
197           perltru64           Perl notes for Tru64
198           perluts             Perl notes for UTS
199           perlvmesa           Perl notes for VM/ESA
200           perlvms             Perl notes for VMS
201           perlvos             Perl notes for Stratus VOS
202           perlwin32           Perl notes for Windows
203
204       By default, the manpages listed above are installed in the
205       /usr/local/man/ directory.
206
207       Extensive additional documentation for Perl modules is available.  The
208       default configuration for perl will place this additional documentation
209       in the /usr/local/lib/perl5/man directory (or else in the man subdirec‐
210       tory of the Perl library directory).  Some of this additional documen‐
211       tation is distributed standard with Perl, but you'll also find documen‐
212       tation for third-party modules there.
213
214       You should be able to view Perl's documentation with your man(1) pro‐
215       gram by including the proper directories in the appropriate start-up
216       files, or in the MANPATH environment variable.  To find out where the
217       configuration has installed the manpages, type:
218
219           perl -V:man.dir
220
221       If the directories have a common stem, such as /usr/local/man/man1 and
222       /usr/local/man/man3, you need only to add that stem (/usr/local/man) to
223       your man(1) configuration files or your MANPATH environment variable.
224       If they do not share a stem, you'll have to add both stems.
225
226       If that doesn't work for some reason, you can still use the supplied
227       perldoc script to view module information.  You might also look into
228       getting a replacement man program.
229
230       If something strange has gone wrong with your program and you're not
231       sure where you should look for help, try the -w switch first.  It will
232       often point out exactly where the trouble is.
233

DESCRIPTION

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

AVAILABILITY

323       Perl is available for most operating systems, including virtually all
324       Unix-like platforms.  See "Supported Platforms" in perlport for a list‐
325       ing.
326

ENVIRONMENT

328       See perlrun.
329

AUTHOR

331       Larry Wall <larry@wall.org>, with the help of oodles of other folks.
332
333       If your Perl success stories and testimonials may be of help to others
334       who wish to advocate the use of Perl in their applications, or if you
335       wish to simply express your gratitude to Larry and the Perl developers,
336       please write to perl-thanks@perl.org .
337

FILES

339        "@INC"                 locations of perl libraries
340

SEE ALSO

342        a2p    awk to perl translator
343        s2p    sed to perl translator
344
345        http://www.perl.org/       the Perl homepage
346        http://www.perl.com/       Perl articles (O'Reilly)
347        http://www.cpan.org/       the Comprehensive Perl Archive
348        http://www.pm.org/         the Perl Mongers
349

DIAGNOSTICS

351       The "use warnings" pragma (and the -w switch) produces some lovely
352       diagnostics.
353
354       See perldiag for explanations of all Perl's diagnostics.  The "use
355       diagnostics" pragma automatically turns Perl's normally terse warnings
356       and errors into these longer forms.
357
358       Compilation errors will tell you the line number of the error, with an
359       indication of the next token or token type that was to be examined.
360       (In a script passed to Perl via -e switches, each -e is counted as one
361       line.)
362
363       Setuid scripts have additional constraints that can produce error mes‐
364       sages such as "Insecure dependency".  See perlsec.
365
366       Did we mention that you should definitely consider using the -w switch?
367

BUGS

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

NOTES

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.8.8                       2006-01-07                           PERL(1)
Impressum