xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/pod/perl.pod (revision 8287:771477e4b843)
1=head1 NAME
2
3perl - Practical Extraction and Report Language
4
5=head1 SYNOPSIS
6
7B<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
15If you're new to Perl, you should start with L<perlintro>, which is a
16general intro for beginners and provides some background to help you
17navigate the rest of Perl's extensive documentation.
18
19For 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    perlcheat		Perl cheat sheet
44    perltrap		Perl traps for the unwary
45    perldebtut		Perl debugging tutorial
46
47    perlfaq		Perl frequently asked questions
48      perlfaq1		General Questions About Perl
49      perlfaq2		Obtaining and Learning about Perl
50      perlfaq3		Programming Tools
51      perlfaq4		Data Manipulation
52      perlfaq5		Files and Formats
53      perlfaq6		Regexes
54      perlfaq7		Perl Language Issues
55      perlfaq8		System Interaction
56      perlfaq9		Networking
57
58=head2 Reference Manual
59
60    perlsyn		Perl syntax
61    perldata		Perl data structures
62    perlop		Perl operators and precedence
63    perlsub		Perl subroutines
64    perlfunc		Perl built-in functions
65      perlopentut	Perl open() tutorial
66      perlpacktut	Perl pack() and unpack() tutorial
67    perlpod		Perl plain old documentation
68    perlpodspec 	Perl plain old documentation format specification
69    perlrun		Perl execution and options
70    perldiag		Perl diagnostic messages
71    perllexwarn 	Perl warnings and their control
72    perldebug		Perl debugging
73    perlvar		Perl predefined variables
74    perlre		Perl regular expressions, the rest of the story
75    perlreref		Perl regular expressions quick reference
76    perlref		Perl references, the rest of the story
77    perlform		Perl formats
78    perlobj		Perl objects
79    perltie		Perl objects hidden behind simple variables
80      perldbmfilter	Perl DBM filters
81
82    perlipc		Perl interprocess communication
83    perlfork		Perl fork() information
84    perlnumber		Perl number semantics
85
86    perlthrtut		Perl threads tutorial
87      perlothrtut	Old Perl threads tutorial
88
89    perlport		Perl portability guide
90    perllocale		Perl locale support
91    perluniintro	Perl Unicode introduction
92    perlunicode 	Perl Unicode support
93    perlebcdic		Considerations for running Perl on EBCDIC platforms
94
95    perlsec		Perl security
96
97    perlmod		Perl modules: how they work
98    perlmodlib		Perl modules: how to write and use
99    perlmodstyle	Perl modules: how to write modules with style
100    perlmodinstall	Perl modules: how to install from CPAN
101    perlnewmod		Perl modules: preparing a new module for distribution
102
103    perlutil		utilities packaged with the Perl distribution
104
105    perlcompile 	Perl compiler suite intro
106
107    perlfilter		Perl source filters
108
109=head2 Internals and C Language Interface
110
111    perlembed		Perl ways to embed perl in your C or C++ application
112    perldebguts 	Perl debugging guts and tips
113    perlxstut		Perl XS tutorial
114    perlxs		Perl XS application programming interface
115    perlclib		Internal replacements for standard C library functions
116    perlguts		Perl internal functions for those doing extensions
117    perlcall		Perl calling conventions from C
118
119    perlapi		Perl API listing (autogenerated)
120    perlintern		Perl internal functions (autogenerated)
121    perliol		C API for Perl's implementation of IO in Layers
122    perlapio		Perl internal IO abstraction interface
123
124    perlhack		Perl hackers guide
125
126=head2 Miscellaneous
127
128    perlbook		Perl book information
129    perltodo		Perl things to do
130
131    perldoc		Look up Perl documentation in Pod format
132
133    perlhist		Perl history records
134    perldelta		Perl changes since previous version
135    perl583delta	Perl changes in version 5.8.3
136    perl582delta	Perl changes in version 5.8.2
137    perl581delta	Perl changes in version 5.8.1
138    perl58delta 	Perl changes in version 5.8.0
139    perl573delta	Perl changes in version 5.7.3
140    perl572delta	Perl changes in version 5.7.2
141    perl571delta	Perl changes in version 5.7.1
142    perl570delta	Perl changes in version 5.7.0
143    perl561delta	Perl changes in version 5.6.1
144    perl56delta 	Perl changes in version 5.6
145    perl5005delta	Perl changes in version 5.005
146    perl5004delta	Perl changes in version 5.004
147
148    perlartistic	Perl Artistic License
149    perlgpl		GNU General Public License
150
151=head2 Language-Specific
152
153    perlcn		Perl for Simplified Chinese (in EUC-CN)
154    perljp		Perl for Japanese (in EUC-JP)
155    perlko		Perl for Korean (in EUC-KR)
156    perltw		Perl for Traditional Chinese (in Big5)
157
158=head2 Platform-Specific
159
160    perlsolaris 	Perl notes for Solaris
161
162
163The manpages listed above are installed in the F</usr/perl5/man/> directory.
164
165Extensive additional documentation for Perl modules is available.  This
166additional documentation is in the F</usr/perl5/man> directory.
167Some of this additional documentation is distributed standard with Perl,
168but you'll also find documentation for any customer-installed third-party
169modules there.
170
171You can view Perl's documentation with man(1) by including /usr/perl5/man
172in the MANPATH environment variable.  Notice that running catman(1M) on the
173Perl manual pages is not supported.  For other Solaris-specific details,
174see the NOTES section below.
175
176You can also use the supplied F</usr/perl5/bin/perldoc> script to view
177Perl information.
178
179If something strange has gone wrong with your program and you're not
180sure where you should look for help, try the B<-w> switch first.  It
181will often point out exactly where the trouble is.
182
183=head1 DESCRIPTION
184
185Perl is a language optimized for scanning arbitrary
186text files, extracting information from those text files, and printing
187reports based on that information.  It's also a good language for many
188system management tasks.  The language is intended to be practical
189(easy to use, efficient, complete) rather than beautiful (tiny,
190elegant, minimal).
191
192Perl combines (in the author's opinion, anyway) some of the best
193features of C, B<sed>, B<awk>, and B<sh>, so people familiar with
194those languages should have little difficulty with it.  (Language
195historians will also note some vestiges of B<csh>, Pascal, and even
196BASIC-PLUS.)  Expression syntax corresponds closely to C
197expression syntax.  Unlike most Unix utilities, Perl does not
198arbitrarily limit the size of your data--if you've got the memory,
199Perl can slurp in your whole file as a single string.  Recursion is of
200unlimited depth.  And the tables used by hashes (sometimes called
201"associative arrays") grow as necessary to prevent degraded
202performance.  Perl can use sophisticated pattern matching techniques to
203scan large amounts of data quickly.  Although optimized for
204scanning text, Perl can also deal with binary data, and can make dbm
205files look like hashes.  Setuid Perl scripts are safer than C programs
206through a dataflow tracing mechanism that prevents many stupid
207security holes.
208
209If you have a problem that would ordinarily use B<sed> or B<awk> or
210B<sh>, but it exceeds their capabilities or must run a little faster,
211and you don't want to write the silly thing in C, then Perl may be for
212you.  There are also translators to turn your B<sed> and B<awk>
213scripts into Perl scripts.
214
215But wait, there's more...
216
217Begun in 1993 (see L<perlhist>), Perl version 5 is nearly a complete
218rewrite that provides the following additional benefits:
219
220=over 4
221
222=item *
223
224modularity and reusability using innumerable modules
225
226Described in L<perlmod>, L<perlmodlib>, and L<perlmodinstall>.
227
228=item *
229
230embeddable and extensible
231
232Described in L<perlembed>, L<perlxstut>, L<perlxs>, L<perlcall>,
233L<perlguts>, and L<xsubpp>.
234
235=item *
236
237roll-your-own magic variables (including multiple simultaneous DBM
238implementations)
239
240Described in L<perltie> and L<AnyDBM_File>.
241
242=item *
243
244subroutines can now be overridden, autoloaded, and prototyped
245
246Described in L<perlsub>.
247
248=item *
249
250arbitrarily nested data structures and anonymous functions
251
252Described in L<perlreftut>, L<perlref>, L<perldsc>, and L<perllol>.
253
254=item *
255
256object-oriented programming
257
258Described in L<perlobj>, L<perlboot>, L<perltoot>, L<perltooc>,
259and L<perlbot>.
260
261=item *
262
263support for light-weight processes (threads)
264
265Described in L<perlthrtut> and L<threads>.
266
267=item *
268
269support for Unicode, internationalization, and localization
270
271Described in L<perluniintro>, L<perllocale> and L<Locale::Maketext>.
272
273=item *
274
275lexical scoping
276
277Described in L<perlsub>.
278
279=item *
280
281regular expression enhancements
282
283Described in L<perlre>, with additional examples in L<perlop>.
284
285=item *
286
287enhanced debugger and interactive Perl environment,
288with integrated editor support
289
290Described in L<perldebtut>, L<perldebug> and L<perldebguts>.
291
292=item *
293
294POSIX 1003.1 compliant library
295
296Described in L<POSIX>.
297
298=back
299
300Okay, that's I<definitely> enough hype.
301
302=head1 AVAILABILITY
303
304Perl is available for most operating systems, including virtually
305all Unix-like platforms.  See L<perlport/"Supported Platforms">
306for a listing.
307
308=head1 ENVIRONMENT
309
310The Perl shipped with Solaris is installed under F</usr/perl5> rather
311than the default F</usr/local> location. This is so that it can coexist
312with a customer-installed Perl in the default F</usr/local> location.
313
314Any additional modules that you choose to install will be placed in the
315F</usr/perl5/site_perl/5.8.4> directory. The F</usr/perl5/vendor_perl>
316directory is reserved for SMI-provided modules.
317
318Notice that the Perl utility scripts such as perldoc and perlbug are in
319the F</usr/perl5/bin> directory, so if you wish to use them you need to
320include F</usr/perl5/bin> in your PATH environment variable.
321
322See also the L<perlrun> mapage.
323
324=head1 AUTHOR
325
326Larry Wall <larry@wall.org>, with the help of oodles of other folks.
327
328If your Perl success stories and testimonials may be of help to others
329who wish to advocate the use of Perl in their applications,
330or if you wish to simply express your gratitude to Larry and the
331Perl developers, please write to perl-thanks@perl.org .
332
333=head1 FILES
334
335 "@INC"			locations of perl libraries
336
337=head1 ATTRIBUTES
338
339See attributes(5) for descriptions of the  following  attributes:
340
341     ____________________________________________________________
342    |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
343    |_____________________________|_____________________________|
344    | Availability                | SUNWperl583core             |
345    |                             | SUNWperl583usr              |
346    |                             | SUNWperl583man              |
347    |_____________________________|_____________________________|
348    | Interface Stability         |                             |
349    |_____________________________|_____________________________|
350    |   o Script interface        | Evolving                    |
351    |_____________________________|_____________________________|
352    |   o XSUB interface          | Evolving                    |
353    |_____________________________|_____________________________|
354    |   o Binary interface        | Unstable                    |
355    |_____________________________|_____________________________|
356    |   o Directory layout        | Evolving                    |
357    |_____________________________|_____________________________|
358
359
360=head1 SEE ALSO
361
362 perlsolaris(1)         Perl version 5 on Solaris systems
363 perlgcc(1)             Compile perl modules using gcc
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
374The C<use warnings> pragma (and the B<-w> switch) produces some
375lovely diagnostics.
376
377See L<perldiag> for explanations of all Perl's diagnostics.  The C<use
378diagnostics> pragma automatically turns Perl's normally terse warnings
379and errors into these longer forms.
380
381Compilation errors will tell you the line number of the error, with an
382indication of the next token or token type that was to be examined.
383(In a script passed to Perl via B<-e> switches, each
384B<-e> is counted as one line.)
385
386Setuid scripts have additional constraints that can produce error
387messages such as "Insecure dependency".  See L<perlsec>.
388
389Did we mention that you should definitely consider using the B<-w>
390switch?
391
392=head1 NOTES
393
394Perl 5.8.4 has been built to be largefile-aware and  to  use 64-bit integers,
395although the interpreter itself is a 32-bit application (LP32).  To view
396detailed configuration information, use perl -V and perlbug -dv.
397
398If you wish to build and install add-on modules from CPAN using gcc, you can do
399so using the /usr/perl5/5.8.4/bin/perlgcc script - see C<perlgcc(1)> for
400details.
401
402If you wish to build and install your own version of Perl, you should NOT
403remove the 5.8.4 version of perl under /usr/perl5, as it is required by
404several system utilities.  The Perl package names are as follows:
405
406     SUNWperl583core    Perl 5.8.4 (Core files)
407     SUNWperl583usr     Perl 5.8.4 (Non-core files)
408     SUNWperl583man     Perl 5.8.4 (Manual pages)
409
410The Perl motto is "There's more than one way to do it."  Divining
411how many more is left as an exercise to the reader.
412
413The three principal virtues of a programmer are Laziness,
414Impatience, and Hubris.  See the Camel Book for why.
415
416=head1 BUGS
417
418The B<-w> switch is not mandatory.
419
420Perl is at the mercy of your machine's definitions of various
421operations such as type casting, atof(), and floating-point
422output with sprintf().
423
424If your stdio requires a seek or eof between reads and writes on a
425particular stream, so does Perl.  (This doesn't apply to sysread()
426and syswrite().)
427
428While none of the built-in data types have any arbitrary size limits
429(apart from memory size), there are still a few arbitrary limits:  a
430given variable name may not be longer than 251 characters.  Line numbers
431displayed by diagnostics are internally stored as short integers,
432so they are limited to a maximum of 65535 (higher numbers usually being
433affected by wraparound).
434
435You may mail your bug reports (be sure to include full configuration
436information as output by the myconfig program in the perl source
437tree, or by C<perl -V>) to perlbug@perl.org .  If you've succeeded
438in compiling perl, the B<perlbug> script in the F<utils/> subdirectory
439can be used to help mail in a bug report.
440
441Perl actually stands for Pathologically Eclectic Rubbish Lister, but
442don't tell anyone I said that.
443
444