perl.html

来自「perl教程」· HTML 代码 · 共 473 行 · 第 1/2 页

HTML
473 行
字号
    <a href="../../lib/Pod/perlce.html">perlce</a>              Perl notes for WinCE
    <a href="../../lib/Pod/perlcygwin.html">perlcygwin</a>          Perl notes for Cygwin
    <a href="../../lib/Pod/perldgux.html">perldgux</a>            Perl notes for DG/UX
    <a href="../../lib/Pod/perldos.html">perldos</a>             Perl notes for DOS
    <a href="../../lib/Pod/perlepoc.html">perlepoc</a>            Perl notes for EPOC
    <a href="../../lib/Pod/perlfreebsd.html">perlfreebsd</a>         Perl notes for FreeBSD
    <a href="../../lib/Pod/perlhpux.html">perlhpux</a>            Perl notes for HP-UX
    <a href="../../lib/Pod/perlhurd.html">perlhurd</a>            Perl notes for Hurd
    <a href="../../lib/Pod/perlirix.html">perlirix</a>            Perl notes for Irix
    <a href="../../lib/Pod/perllinux.html">perllinux</a>           Perl notes for Linux
    <a href="../../lib/Pod/perlmachten.html">perlmachten</a>         Perl notes for Power MachTen
    <a href="../../lib/Pod/perlmacos.html">perlmacos</a>           Perl notes for Mac OS (Classic)
    <a href="../../lib/Pod/perlmacosx.html">perlmacosx</a>          Perl notes for Mac OS X
    <a href="../../lib/Pod/perlmint.html">perlmint</a>            Perl notes for MiNT
    <a href="../../lib/Pod/perlmpeix.html">perlmpeix</a>           Perl notes for MPE/iX
    <a href="../../lib/Pod/perlnetware.html">perlnetware</a>         Perl notes for NetWare
    <a href="../../lib/Pod/perlopenbsd.html">perlopenbsd</a>         Perl notes for OpenBSD
    <a href="../../lib/Pod/perlos2.html">perlos2</a>             Perl notes for OS/2
    <a href="../../lib/Pod/perlos390.html">perlos390</a>           Perl notes for OS/390
    <a href="../../lib/Pod/perlos400.html">perlos400</a>           Perl notes for OS/400
    <a href="../../lib/Pod/perlplan9.html">perlplan9</a>           Perl notes for Plan 9
    <a href="../../lib/Pod/perlqnx.html">perlqnx</a>             Perl notes for QNX
    <a href="../../lib/Pod/perlsolaris.html">perlsolaris</a>         Perl notes for Solaris
    <a href="../../lib/Pod/perltru64.html">perltru64</a>           Perl notes for Tru64
    <a href="../../lib/Pod/perluts.html">perluts</a>             Perl notes for UTS
    <a href="../../lib/Pod/perlvmesa.html">perlvmesa</a>           Perl notes for VM/ESA
    <a href="../../lib/Pod/perlvms.html">perlvms</a>             Perl notes for VMS
    <a href="../../lib/Pod/perlvos.html">perlvos</a>             Perl notes for Stratus VOS
    <a href="../../lib/Pod/perlwin32.html">perlwin32</a>           Perl notes for Windows</pre>
<p>By default, the manpages listed above are installed in the 
<em>/usr/local/man/</em> directory.</p>
<p>Extensive additional documentation for Perl modules is available.  The
default configuration for perl will place this additional documentation
in the <em>/usr/local/lib/perl5/man</em> directory (or else in the <em>man</em>
subdirectory of the Perl library directory).  Some of this additional
documentation is distributed standard with Perl, but you'll also find
documentation for third-party modules there.</p>
<p>You should be able to view Perl's documentation with your <code>man(1)</code>
program by including the proper directories in the appropriate start-up
files, or in the MANPATH environment variable.  To find out where the
configuration has installed the manpages, type:</p>
<pre>
    perl -V:man.dir</pre>
<p>If the directories have a common stem, such as <em>/usr/local/man/man1</em>
and <em>/usr/local/man/man3</em>, you need only to add that stem
(<em>/usr/local/man</em>) to your <code>man(1)</code> configuration files or your MANPATH
environment variable.  If they do not share a stem, you'll have to add
both stems.</p>
<p>If that doesn't work for some reason, you can still use the
supplied <em>perldoc</em> script to view module information.  You might
also look into getting a replacement man program.</p>
<p>If something strange has gone wrong with your program and you're not
sure where you should look for help, try the <strong>-w</strong> switch first.  It
will often point out exactly where the trouble is.</p>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>Perl is a language optimized for scanning arbitrary
text files, extracting information from those text files, and printing
reports based on that information.  It's also a good language for many
system management tasks.  The language is intended to be practical
(easy to use, efficient, complete) rather than beautiful (tiny,
elegant, minimal).</p>
<p>Perl combines (in the author's opinion, anyway) some of the best
features of C, <strong>sed</strong>, <strong>awk</strong>, and <strong>sh</strong>, so people familiar with
those languages should have little difficulty with it.  (Language
historians will also note some vestiges of <strong>csh</strong>, Pascal, and even
BASIC-PLUS.)  Expression syntax corresponds closely to C
expression syntax.  Unlike most Unix utilities, Perl does not
arbitrarily limit the size of your data--if you've got the memory,
Perl can slurp in your whole file as a single string.  Recursion is of
unlimited depth.  And the tables used by hashes (sometimes called
&quot;associative arrays&quot;) grow as necessary to prevent degraded
performance.  Perl can use sophisticated pattern matching techniques to
scan large amounts of data quickly.  Although optimized for
scanning text, Perl can also deal with binary data, and can make dbm
files look like hashes.  Setuid Perl scripts are safer than C programs
through a dataflow tracing mechanism that prevents many stupid
security holes.</p>
<p>If you have a problem that would ordinarily use <strong>sed</strong> or <strong>awk</strong> or
<strong>sh</strong>, but it exceeds their capabilities or must run a little faster,
and you don't want to write the silly thing in C, then Perl may be for
you.  There are also translators to turn your <strong>sed</strong> and <strong>awk</strong>
scripts into Perl scripts.</p>
<p>But wait, there's more...</p>
<p>Begun in 1993 (see <a href="../../lib/Pod/perlhist.html">the perlhist manpage</a>), Perl version 5 is nearly a complete
rewrite that provides the following additional benefits:</p>
<ul>
<li>
<p>modularity and reusability using innumerable modules</p>
<p>Described in <a href="../../lib/Pod/perlmod.html">the perlmod manpage</a>, <a href="../../lib/Pod/perlmodlib.html">the perlmodlib manpage</a>, and <a href="../../lib/Pod/perlmodinstall.html">the perlmodinstall manpage</a>.</p>
</li>
<li>
<p>embeddable and extensible</p>
<p>Described in <a href="../../lib/Pod/perlembed.html">the perlembed manpage</a>, <a href="../../lib/Pod/perlxstut.html">the perlxstut manpage</a>, <a href="../../lib/Pod/perlxs.html">the perlxs manpage</a>, <a href="../../lib/Pod/perlcall.html">the perlcall manpage</a>,
<a href="../../lib/Pod/perlguts.html">the perlguts manpage</a>, and <a href="../../lib/ExtUtils/xsubpp.html">the xsubpp manpage</a>.</p>
</li>
<li>
<p>roll-your-own magic variables (including multiple simultaneous DBM
implementations)</p>
<p>Described in <a href="../../lib/Pod/perltie.html">the perltie manpage</a> and <a href="../../lib/AnyDBM_File.html">the AnyDBM_File manpage</a>.</p>
</li>
<li>
<p>subroutines can now be overridden, autoloaded, and prototyped</p>
<p>Described in <a href="../../lib/Pod/perlsub.html">the perlsub manpage</a>.</p>
</li>
<li>
<p>arbitrarily nested data structures and anonymous functions</p>
<p>Described in <a href="../../lib/Pod/perlreftut.html">the perlreftut manpage</a>, <a href="../../lib/Pod/perlref.html">the perlref manpage</a>, <a href="../../lib/Pod/perldsc.html">the perldsc manpage</a>, and <a href="../../lib/Pod/perllol.html">the perllol manpage</a>.</p>
</li>
<li>
<p>object-oriented programming</p>
<p>Described in <a href="../../lib/Pod/perlobj.html">the perlobj manpage</a>, <a href="../../lib/Pod/perlboot.html">the perlboot manpage</a>, <a href="../../lib/Pod/perltoot.html">the perltoot manpage</a>, <a href="../../lib/Pod/perltooc.html">the perltooc manpage</a>,
and <a href="../../lib/Pod/perlbot.html">the perlbot manpage</a>.</p>
</li>
<li>
<p>support for light-weight processes (threads)</p>
<p>Described in <a href="../../lib/Pod/perlthrtut.html">the perlthrtut manpage</a> and <a href="../../lib/threads.html">the threads manpage</a>.</p>
</li>
<li>
<p>support for Unicode, internationalization, and localization</p>
<p>Described in <a href="../../lib/Pod/perluniintro.html">the perluniintro manpage</a>, <a href="../../lib/Pod/perllocale.html">the perllocale manpage</a> and <a href="../../lib/Locale/Maketext.html">the Locale::Maketext manpage</a>.</p>
</li>
<li>
<p>lexical scoping</p>
<p>Described in <a href="../../lib/Pod/perlsub.html">the perlsub manpage</a>.</p>
</li>
<li>
<p>regular expression enhancements</p>
<p>Described in <a href="../../lib/Pod/perlre.html">the perlre manpage</a>, with additional examples in <a href="../../lib/Pod/perlop.html">the perlop manpage</a>.</p>
</li>
<li>
<p>enhanced debugger and interactive Perl environment,
with integrated editor support</p>
<p>Described in <a href="../../lib/Pod/perldebtut.html">the perldebtut manpage</a>, <a href="../../lib/Pod/perldebug.html">the perldebug manpage</a> and <a href="../../lib/Pod/perldebguts.html">the perldebguts manpage</a>.</p>
</li>
<li>
<p>POSIX 1003.1 compliant library</p>
<p>Described in <a href="../../lib/POSIX.html">the POSIX manpage</a>.</p>
</li>
</ul>
<p>Okay, that's <em>definitely</em> enough hype.</p>
<p>
</p>
<hr />
<h1><a name="availability">AVAILABILITY</a></h1>
<p>Perl is available for most operating systems, including virtually
all Unix-like platforms.  See <a href="../../lib/Pod/perlport.html#supported_platforms">Supported Platforms in the perlport manpage</a>
for a listing.</p>
<p>
</p>
<hr />
<h1><a name="environment">ENVIRONMENT</a></h1>
<p>See <a href="../../lib/Pod/perlrun.html">the perlrun manpage</a>.</p>
<p>
</p>
<hr />
<h1><a name="author">AUTHOR</a></h1>
<p>Larry Wall &lt;<a href="mailto:larry@wall.org">larry@wall.org</a>&gt;, with the help of oodles of other folks.</p>
<p>If your Perl success stories and testimonials may be of help to others 
who wish to advocate the use of Perl in their applications, 
or if you wish to simply express your gratitude to Larry and the 
Perl developers, please write to <a href="mailto:perl-thanks@perl.org">perl-thanks@perl.org</a> .</p>
<p>
</p>
<hr />
<h1><a name="files">FILES</a></h1>
<pre>
 &quot;@INC&quot;                 locations of perl libraries</pre>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<pre>
 a2p    awk to perl translator
 s2p    sed to perl translator</pre>
<pre>
 <a href="http://www.perl.org/">http://www.perl.org/</a>       the Perl homepage
 <a href="http://www.perl.com/">http://www.perl.com/</a>       Perl articles (O'Reilly)
 <a href="http://www.cpan.org/">http://www.cpan.org/</a>       the Comprehensive Perl Archive
 <a href="http://www.pm.org/">http://www.pm.org/</a>         the Perl Mongers</pre>
<p>
</p>
<hr />
<h1><a name="diagnostics">DIAGNOSTICS</a></h1>
<p>The <code>use warnings</code> pragma (and the <strong>-w</strong> switch) produces some 
lovely diagnostics.</p>
<p>See <a href="../../lib/Pod/perldiag.html">the perldiag manpage</a> for explanations of all Perl's diagnostics.  The <code>use
diagnostics</code> pragma automatically turns Perl's normally terse warnings
and errors into these longer forms.</p>
<p>Compilation errors will tell you the line number of the error, with an
indication of the next token or token type that was to be examined.
(In a script passed to Perl via <strong>-e</strong> switches, each
<strong>-e</strong> is counted as one line.)</p>
<p>Setuid scripts have additional constraints that can produce error
messages such as &quot;Insecure dependency&quot;.  See <a href="../../lib/Pod/perlsec.html">the perlsec manpage</a>.</p>
<p>Did we mention that you should definitely consider using the <strong>-w</strong>
switch?</p>
<p>
</p>
<hr />
<h1><a name="bugs">BUGS</a></h1>
<p>The <strong>-w</strong> switch is not mandatory.</p>
<p>Perl is at the mercy of your machine's definitions of various
operations such as type casting, atof(), and floating-point
output with sprintf().</p>
<p>If your stdio requires a seek or eof between reads and writes on a
particular stream, so does Perl.  (This doesn't apply to <a href="../../lib/Pod/perlfunc.html#item_sysread"><code>sysread()</code></a>
and <a href="../../lib/Pod/perlfunc.html#item_syswrite"><code>syswrite().)</code></a></p>
<p>While none of the built-in data types have any arbitrary size limits
(apart from memory size), there are still a few arbitrary limits:  a
given variable name may not be longer than 251 characters.  Line numbers
displayed by diagnostics are internally stored as short integers,
so they are limited to a maximum of 65535 (higher numbers usually being
affected by wraparound).</p>
<p>You may mail your bug reports (be sure to include full configuration
information as output by the myconfig program in the perl source
tree, or by <code>perl -V</code>) to <a href="mailto:perlbug@perl.org">perlbug@perl.org</a> .  If you've succeeded
in compiling perl, the <strong>perlbug</strong> script in the <em>utils/</em> subdirectory
can be used to help mail in a bug report.</p>
<p>Perl actually stands for Pathologically Eclectic Rubbish Lister, but
don't tell anyone I said that.</p>
<p>
</p>
<hr />
<h1><a name="notes">NOTES</a></h1>
<p>The Perl motto is &quot;There's more than one way to do it.&quot;  Divining
how many more is left as an exercise to the reader.</p>
<p>The three principal virtues of a programmer are Laziness,
Impatience, and Hubris.  See the Camel Book for why.</p>

</body>

</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?