Microperl expects C89 (like the rest of Perl).
[p5sagit/p5-mst-13.2.git] / pod / perl.pod
1 =head1 NAME
2
3 perl - Practical Extraction and Report Language
4
5 =head1 SYNOPSIS
6
7 B<perl> S<[ B<-sTuU> ]> S<[ B<-hv> ] [ B<-V>[:I<configvar>] ]>
8     S<[ B<-cw> ] [ B<-d>[:I<debugger>] ] [ B<-D>[I<number/list>] ]>
9     S<[ B<-pna> ] [ B<-F>I<pattern> ] [ B<-l>[I<octal>] ] [ B<-0>[I<octal>] ]>
10     S<[ B<-I>I<dir> ] [ B<-m>[B<->]I<module> ] [ B<-M>[B<->]I<'module...'> ]>
11     S<[ B<-P> ]> S<[ B<-S> ]> S<[ B<-x>[I<dir>] ]>
12     S<[ B<-i>[I<extension>] ]> S<[ B<-e> I<'command'> ] 
13     [ B<--> ] [ I<programfile> ] [ I<argument> ]...>
14
15 If you're new to Perl, you should start with L<perlintro>, which is a 
16 general intro for beginners and provides some background to help you
17 navigate the rest of Perl's extensive documentation.
18
19 For ease of access, the Perl manual has been split up into several sections.
20
21 =head2 Overview
22
23     perl                Perl overview (this section)
24     perlintro           Perl introduction for beginners
25     perltoc             Perl documentation table of contents
26
27 =head2 Tutorials
28
29     perlreftut          Perl references short introduction
30     perldsc             Perl data structures intro
31     perllol             Perl data structures: arrays of arrays
32
33     perlrequick         Perl regular expressions quick start
34     perlretut           Perl regular expressions tutorial
35
36     perlboot            Perl OO tutorial for beginners
37     perltoot            Perl OO tutorial, part 1
38     perltooc            Perl OO tutorial, part 2
39     perlbot             Perl OO tricks and examples
40
41     perlstyle           Perl style guide
42
43     perltrap            Perl traps for the unwary
44     perldebtut          Perl debugging tutorial
45
46     perlfaq             Perl frequently asked questions
47       perlfaq1          General Questions About Perl
48       perlfaq2          Obtaining and Learning about Perl
49       perlfaq3          Programming Tools
50       perlfaq4          Data Manipulation
51       perlfaq5          Files and Formats
52       perlfaq6          Regexes
53       perlfaq7          Perl Language Issues
54       perlfaq8          System Interaction
55       perlfaq9          Networking
56
57 =head2 Reference Manual
58
59     perlsyn             Perl syntax
60     perldata            Perl data structures
61     perlop              Perl operators and precedence
62     perlsub             Perl subroutines
63     perlfunc            Perl built-in functions
64       perlopentut       Perl open() tutorial
65       perlpacktut       Perl pack() and unpack() tutorial
66     perlpod             Perl plain old documentation
67     perlpodspec         Perl plain old documentation format specification
68     perlrun             Perl execution and options
69     perldiag            Perl diagnostic messages
70     perllexwarn         Perl warnings and their control
71     perldebug           Perl debugging
72     perlvar             Perl predefined variables
73     perlre              Perl regular expressions, the rest of the story
74     perlreref           Perl regular expressions quick reference
75     perlref             Perl references, the rest of the story
76     perlform            Perl formats
77     perlobj             Perl objects
78     perltie             Perl objects hidden behind simple variables
79       perldbmfilter     Perl DBM filters
80
81     perlipc             Perl interprocess communication
82     perlfork            Perl fork() information
83     perlnumber          Perl number semantics
84
85     perlthrtut          Perl threads tutorial
86       perlothrtut         Old Perl threads tutorial
87
88     perlport            Perl portability guide
89     perllocale          Perl locale support
90     perluniintro        Perl Unicode introduction
91     perlunicode         Perl Unicode support
92     perlebcdic          Considerations for running Perl on EBCDIC platforms
93
94     perlsec             Perl security
95
96     perlmod             Perl modules: how they work
97     perlmodlib          Perl modules: how to write and use
98     perlmodstyle        Perl modules: how to write modules with style
99     perlmodinstall      Perl modules: how to install from CPAN
100     perlnewmod          Perl modules: preparing a new module for distribution
101
102     perlutil            utilities packaged with the Perl distribution
103
104     perlcompile         Perl compiler suite intro
105
106     perlfilter          Perl source filters
107
108 =head2 Internals and C Language Interface
109
110     perlembed           Perl ways to embed perl in your C or C++ application
111     perldebguts         Perl debugging guts and tips
112     perlxstut           Perl XS tutorial
113     perlxs              Perl XS application programming interface
114     perlclib            Internal replacements for standard C library functions
115     perlguts            Perl internal functions for those doing extensions
116     perlcall            Perl calling conventions from C
117
118     perlapi             Perl API listing (autogenerated)
119     perlintern          Perl internal functions (autogenerated)
120     perliol             C API for Perl's implementation of IO in Layers
121     perlapio            Perl internal IO abstraction interface
122
123     perlhack            Perl hackers guide
124
125 =head2 Miscellaneous
126
127     perlbook            Perl book information
128     perltodo            Perl things to do
129
130     perldoc             Look up Perl documentation in Pod format
131
132     perlhist            Perl history records
133     perldelta           Perl changes since previous version
134     perl58delta         Perl changes in version 5.8.0
135     perl573delta        Perl changes in version 5.7.3
136     perl572delta        Perl changes in version 5.7.2
137     perl571delta        Perl changes in version 5.7.1
138     perl570delta        Perl changes in version 5.7.0
139     perl561delta        Perl changes in version 5.6.1
140     perl56delta         Perl changes in version 5.6
141     perl5005delta       Perl changes in version 5.005
142     perl5004delta       Perl changes in version 5.004
143
144     perlartistic        Perl Artistic License
145     perlgpl             GNU General Public License
146
147 =head2 Language-Specific
148
149     perlcn              Perl for Simplified Chinese (in EUC-CN)
150     perljp              Perl for Japanese (in EUC-JP)
151     perlko              Perl for Korean (in EUC-KR)
152     perltw              Perl for Traditional Chinese (in Big5)
153
154 =head2 Platform-Specific
155
156     perlaix             Perl notes for AIX
157     perlamiga           Perl notes for AmigaOS
158     perlapollo          Perl notes for Apollo DomainOS
159     perlbeos            Perl notes for BeOS
160     perlbs2000          Perl notes for POSIX-BC BS2000
161     perlce              Perl notes for WinCE
162     perlcygwin          Perl notes for Cygwin
163     perldgux            Perl notes for DG/UX
164     perldos             Perl notes for DOS
165     perlepoc            Perl notes for EPOC
166     perlfreebsd         Perl notes for FreeBSD
167     perlhpux            Perl notes for HP-UX
168     perlhurd            Perl notes for Hurd
169     perlirix            Perl notes for Irix
170     perlmachten         Perl notes for Power MachTen
171     perlmacos           Perl notes for Mac OS (Classic)
172     perlmacosx          Perl notes for Mac OS X
173     perlmint            Perl notes for MiNT
174     perlmpeix           Perl notes for MPE/iX
175     perlnetware         Perl notes for NetWare
176     perlos2             Perl notes for OS/2
177     perlos390           Perl notes for OS/390
178     perlos400           Perl notes for OS/400
179     perlplan9           Perl notes for Plan 9
180     perlqnx             Perl notes for QNX
181     perlsolaris         Perl notes for Solaris
182     perltru64           Perl notes for Tru64
183     perluts             Perl notes for UTS
184     perlvmesa           Perl notes for VM/ESA
185     perlvms             Perl notes for VMS
186     perlvos             Perl notes for Stratus VOS
187     perlwin32           Perl notes for Windows
188
189
190 By default, the manpages listed above are installed in the 
191 F</usr/local/man/> directory.  
192
193 Extensive additional documentation for Perl modules is available.  The
194 default configuration for perl will place this additional documentation
195 in the F</usr/local/lib/perl5/man> directory (or else in the F<man>
196 subdirectory of the Perl library directory).  Some of this additional
197 documentation is distributed standard with Perl, but you'll also find
198 documentation for third-party modules there.
199
200 You should be able to view Perl's documentation with your man(1)
201 program by including the proper directories in the appropriate start-up
202 files, or in the MANPATH environment variable.  To find out where the
203 configuration has installed the manpages, type:
204
205     perl -V:man.dir
206
207 If the directories have a common stem, such as F</usr/local/man/man1>
208 and F</usr/local/man/man3>, you need only to add that stem
209 (F</usr/local/man>) to your man(1) configuration files or your MANPATH
210 environment variable.  If they do not share a stem, you'll have to add
211 both stems.
212
213 If that doesn't work for some reason, you can still use the
214 supplied F<perldoc> script to view module information.  You might
215 also look into getting a replacement man program.
216
217 If something strange has gone wrong with your program and you're not
218 sure where you should look for help, try the B<-w> switch first.  It
219 will often point out exactly where the trouble is.
220
221 =head1 DESCRIPTION
222
223 Perl is a language optimized for scanning arbitrary
224 text files, extracting information from those text files, and printing
225 reports based on that information.  It's also a good language for many
226 system management tasks.  The language is intended to be practical
227 (easy to use, efficient, complete) rather than beautiful (tiny,
228 elegant, minimal).
229
230 Perl combines (in the author's opinion, anyway) some of the best
231 features of C, B<sed>, B<awk>, and B<sh>, so people familiar with
232 those languages should have little difficulty with it.  (Language
233 historians will also note some vestiges of B<csh>, Pascal, and even
234 BASIC-PLUS.)  Expression syntax corresponds closely to C
235 expression syntax.  Unlike most Unix utilities, Perl does not
236 arbitrarily limit the size of your data--if you've got the memory,
237 Perl can slurp in your whole file as a single string.  Recursion is of
238 unlimited depth.  And the tables used by hashes (sometimes called
239 "associative arrays") grow as necessary to prevent degraded
240 performance.  Perl can use sophisticated pattern matching techniques to
241 scan large amounts of data quickly.  Although optimized for
242 scanning text, Perl can also deal with binary data, and can make dbm
243 files look like hashes.  Setuid Perl scripts are safer than C programs
244 through a dataflow tracing mechanism that prevents many stupid
245 security holes.
246
247 If you have a problem that would ordinarily use B<sed> or B<awk> or
248 B<sh>, but it exceeds their capabilities or must run a little faster,
249 and you don't want to write the silly thing in C, then Perl may be for
250 you.  There are also translators to turn your B<sed> and B<awk>
251 scripts into Perl scripts.
252
253 But wait, there's more...
254
255 Begun in 1993 (see L<perlhist>), Perl version 5 is nearly a complete
256 rewrite that provides the following additional benefits:
257
258 =over 4
259
260 =item *
261
262 modularity and reusability using innumerable modules 
263
264 Described in L<perlmod>, L<perlmodlib>, and L<perlmodinstall>.
265
266 =item *
267
268 embeddable and extensible 
269
270 Described in L<perlembed>, L<perlxstut>, L<perlxs>, L<perlcall>,
271 L<perlguts>, and L<xsubpp>.
272
273 =item *
274
275 roll-your-own magic variables (including multiple simultaneous DBM
276 implementations)
277
278 Described in L<perltie> and L<AnyDBM_File>.
279
280 =item *
281
282 subroutines can now be overridden, autoloaded, and prototyped
283
284 Described in L<perlsub>.
285
286 =item *
287
288 arbitrarily nested data structures and anonymous functions
289
290 Described in L<perlreftut>, L<perlref>, L<perldsc>, and L<perllol>.
291
292 =item *
293
294 object-oriented programming
295
296 Described in L<perlobj>, L<perlboot>, L<perltoot>, L<perltooc>,
297 and L<perlbot>.
298
299 =item *
300
301 support for light-weight processes (threads)
302
303 Described in L<perlthrtut> and L<threads>.
304
305 =item *
306
307 support for Unicode, internationalization, and localization
308
309 Described in L<perluniintro>, L<perllocale> and L<Locale::Maketext>.
310
311 =item *
312
313 lexical scoping
314
315 Described in L<perlsub>.
316
317 =item *
318
319 regular expression enhancements
320
321 Described in L<perlre>, with additional examples in L<perlop>.
322
323 =item *
324
325 enhanced debugger and interactive Perl environment,
326 with integrated editor support
327
328 Described in L<perldebtut>, L<perldebug> and L<perldebguts>.
329
330 =item *
331
332 POSIX 1003.1 compliant library
333
334 Described in L<POSIX>.
335
336 =back
337
338 Okay, that's I<definitely> enough hype.
339
340 =head1 AVAILABILITY
341
342 Perl is available for most operating systems, including virtually
343 all Unix-like platforms.  See L<perlport/"Supported Platforms">
344 for a listing.
345
346 =head1 ENVIRONMENT
347
348 See L<perlrun>.
349
350 =head1 AUTHOR
351
352 Larry Wall <larry@wall.org>, with the help of oodles of other folks.
353
354 If your Perl success stories and testimonials may be of help to others 
355 who wish to advocate the use of Perl in their applications, 
356 or if you wish to simply express your gratitude to Larry and the 
357 Perl developers, please write to perl-thanks@perl.org .
358
359 =head1 FILES
360
361  "@INC"                 locations of perl libraries
362
363 =head1 SEE ALSO
364
365  a2p    awk to perl translator
366  s2p    sed to perl translator
367
368  http://www.perl.com/       the Perl Home Page
369  http://www.cpan.org/       the Comprehensive Perl Archive
370  http://www.perl.org/       Perl Mongers (Perl user groups)
371
372 =head1 DIAGNOSTICS
373
374 The C<use warnings> pragma (and the B<-w> switch) produces some 
375 lovely diagnostics.
376
377 See L<perldiag> for explanations of all Perl's diagnostics.  The C<use
378 diagnostics> pragma automatically turns Perl's normally terse warnings
379 and errors into these longer forms.
380
381 Compilation errors will tell you the line number of the error, with an
382 indication of the next token or token type that was to be examined.
383 (In a script passed to Perl via B<-e> switches, each
384 B<-e> is counted as one line.)
385
386 Setuid scripts have additional constraints that can produce error
387 messages such as "Insecure dependency".  See L<perlsec>.
388
389 Did we mention that you should definitely consider using the B<-w>
390 switch?
391
392 =head1 BUGS
393
394 The B<-w> switch is not mandatory.
395
396 Perl is at the mercy of your machine's definitions of various
397 operations such as type casting, atof(), and floating-point
398 output with sprintf().
399
400 If your stdio requires a seek or eof between reads and writes on a
401 particular stream, so does Perl.  (This doesn't apply to sysread()
402 and syswrite().)
403
404 While none of the built-in data types have any arbitrary size limits
405 (apart from memory size), there are still a few arbitrary limits:  a
406 given variable name may not be longer than 251 characters.  Line numbers
407 displayed by diagnostics are internally stored as short integers,
408 so they are limited to a maximum of 65535 (higher numbers usually being
409 affected by wraparound).
410
411 You may mail your bug reports (be sure to include full configuration
412 information as output by the myconfig program in the perl source
413 tree, or by C<perl -V>) to perlbug@perl.org .  If you've succeeded
414 in compiling perl, the B<perlbug> script in the F<utils/> subdirectory
415 can be used to help mail in a bug report.
416
417 Perl actually stands for Pathologically Eclectic Rubbish Lister, but
418 don't tell anyone I said that.
419
420 =head1 NOTES
421
422 The Perl motto is "There's more than one way to do it."  Divining
423 how many more is left as an exercise to the reader.
424
425 The three principal virtues of a programmer are Laziness,
426 Impatience, and Hubris.  See the Camel Book for why.
427