home *** CD-ROM | disk | FTP | other *** search
/ Acorn User 10 / AU_CD10.iso / Updates / Perl / Non-RPC / Docs / perl next >
Text File  |  1999-04-17  |  16KB  |  393 lines

  1. NAME
  2.     perl - Practical Extraction and Report Language
  3.  
  4. SYNOPSIS
  5.     perl [ -sTuU ] [ -hv ] [ -V[:*configvar*] ] [ -cw ] [
  6.     -d[:*debugger*] ] [ -D[*number/list*] ] [ -pna ] [ -F*pattern* ]
  7.     [ -l[*octal*] ] [ -0[*octal*] ] [ -I*dir* ] [ -m[-]*module* ] [
  8.     -M[-]*'module...'* ] [ -P ] [ -S ] [ -x[*dir*] ] [
  9.     -i[*extension*] ] [ -e *'command'* ] [ -- ] [ *programfile* ] [
  10.     *argument* ]...
  11.  
  12.     For ease of access, the Perl manual has been split up into a
  13.     number of sections:
  14.  
  15.         perl        Perl overview (this section)
  16.         perldelta        Perl changes since previous version
  17.         perl5004delta    Perl changes in version 5.004
  18.         perlfaq        Perl frequently asked questions
  19.         perltoc        Perl documentation table of contents
  20.  
  21.         perldata        Perl data structures
  22.         perlsyn        Perl syntax
  23.         perlop        Perl operators and precedence
  24.         perlre        Perl regular expressions
  25.         perlrun        Perl execution and options
  26.         perlfunc        Perl builtin functions
  27.         perlopentut        Perl open() tutorial
  28.         perlvar        Perl predefined variables
  29.         perlsub        Perl subroutines
  30.         perlmod        Perl modules: how they work
  31.         perlmodlib        Perl modules: how to write and use
  32.         perlmodinstall    Perl modules: how to install from CPAN
  33.         perlform        Perl formats
  34.         perllocale        Perl locale support
  35.  
  36.         perlref        Perl references
  37.         perlreftut        Perl references short introduction
  38.         perldsc        Perl data structures intro
  39.         perllol        Perl data structures: lists of lists
  40.         perltoot        Perl OO tutorial
  41.         perlobj        Perl objects
  42.         perltie        Perl objects hidden behind simple variables
  43.         perlbot        Perl OO tricks and examples
  44.         perlipc        Perl interprocess communication
  45.         perlthrtut        Perl threads tutorial
  46.  
  47.         perldebug        Perl debugging
  48.         perldiag        Perl diagnostic messages
  49.         perlsec        Perl security
  50.         perltrap        Perl traps for the unwary
  51.         perlport        Perl portability guide
  52.         perlstyle        Perl style guide
  53.  
  54.         perlpod        Perl plain old documentation
  55.         perlbook        Perl book information
  56.  
  57.         perlembed        Perl ways to embed perl in your C or C++ application
  58.         perlapio        Perl internal IO abstraction interface
  59.         perlxs        Perl XS application programming interface
  60.         perlxstut        Perl XS tutorial
  61.         perlguts        Perl internal functions for those doing extensions
  62.         perlcall        Perl calling conventions from C
  63.  
  64.         perlhist        Perl history records
  65.  
  66.  
  67.     (If you're intending to read these straight through for the
  68.     first time, the suggested order will tend to reduce the number
  69.     of forward references.)
  70.  
  71.     By default, all of the above manpages are installed in the
  72.     /usr/local/man/ directory.
  73.  
  74.     Extensive additional documentation for Perl modules is
  75.     available. The default configuration for perl will place this
  76.     additional documentation in the /usr/local/lib/perl5/man
  77.     directory (or else in the man subdirectory of the Perl library
  78.     directory). Some of this additional documentation is distributed
  79.     standard with Perl, but you'll also find documentation for
  80.     third-party modules there.
  81.  
  82.     You should be able to view Perl's documentation with your man(1)
  83.     program by including the proper directories in the appropriate
  84.     start-up files, or in the MANPATH environment variable. To find
  85.     out where the configuration has installed the manpages, type:
  86.  
  87.         perl -V:man.dir
  88.  
  89.  
  90.     If the directories have a common stem, such as
  91.     /usr/local/man/man1 and /usr/local/man/man3, you need only to
  92.     add that stem (/usr/local/man) to your man(1) configuration
  93.     files or your MANPATH environment variable. If they do not share
  94.     a stem, you'll have to add both stems.
  95.  
  96.     If that doesn't work for some reason, you can still use the
  97.     supplied perldoc script to view module information. You might
  98.     also look into getting a replacement man program.
  99.  
  100.     If something strange has gone wrong with your program and you're
  101.     not sure where you should look for help, try the -w switch
  102.     first. It will often point out exactly where the trouble is.
  103.  
  104. DESCRIPTION
  105.     Perl is a language optimized for scanning arbitrary text files,
  106.     extracting information from those text files, and printing
  107.     reports based on that information. It's also a good language for
  108.     many system management tasks. The language is intended to be
  109.     practical (easy to use, efficient, complete) rather than
  110.     beautiful (tiny, elegant, minimal).
  111.  
  112.     Perl combines (in the author's opinion, anyway) some of the best
  113.     features of C, sed, awk, and sh, so people familiar with those
  114.     languages should have little difficulty with it. (Language
  115.     historians will also note some vestiges of csh, Pascal, and even
  116.     BASIC-PLUS.) Expression syntax corresponds quite closely to C
  117.     expression syntax. Unlike most Unix utilities, Perl does not
  118.     arbitrarily limit the size of your data--if you've got the
  119.     memory, Perl can slurp in your whole file as a single string.
  120.     Recursion is of unlimited depth. And the tables used by hashes
  121.     (sometimes called "associative arrays") grow as necessary to
  122.     prevent degraded performance. Perl can use sophisticated pattern
  123.     matching techniques to scan large amounts of data very quickly.
  124.     Although optimized for scanning text, Perl can also deal with
  125.     binary data, and can make dbm files look like hashes. Setuid
  126.     Perl scripts are safer than C programs through a dataflow
  127.     tracing mechanism which prevents many stupid security holes.
  128.  
  129.     If you have a problem that would ordinarily use sed or awk or
  130.     sh, but it exceeds their capabilities or must run a little
  131.     faster, and you don't want to write the silly thing in C, then
  132.     Perl may be for you. There are also translators to turn your sed
  133.     and awk scripts into Perl scripts.
  134.  
  135.     But wait, there's more...
  136.  
  137.     Perl version 5 is nearly a complete rewrite, and provides the
  138.     following additional benefits:
  139.  
  140.     * Many usability enhancements
  141.          It is now possible to write much more readable Perl code
  142.          (even within regular expressions). Formerly cryptic
  143.          variable names can be replaced by mnemonic identifiers.
  144.          Error messages are more informative, and the optional
  145.          warnings will catch many of the mistakes a novice might
  146.          make. This cannot be stressed enough. Whenever you get
  147.          mysterious behavior, try the -w switch!!! Whenever you
  148.          don't get mysterious behavior, try using -w anyway.
  149.  
  150.     * Simplified grammar
  151.          The new yacc grammar is one half the size of the old one.
  152.          Many of the arbitrary grammar rules have been regularized.
  153.          The number of reserved words has been cut by 2/3. Despite
  154.          this, nearly all old Perl scripts will continue to work
  155.          unchanged.
  156.  
  157.     * Lexical scoping
  158.          Perl variables may now be declared within a lexical scope,
  159.          like "auto" variables in C. Not only is this more
  160.          efficient, but it contributes to better privacy for
  161.          "programming in the large". Anonymous subroutines exhibit
  162.          deep binding of lexical variables (closures).
  163.  
  164.     * Arbitrarily nested data structures
  165.          Any scalar value, including any array element, may now
  166.          contain a reference to any other variable or subroutine.
  167.          You can easily create anonymous variables and subroutines.
  168.          Perl manages your reference counts for you.
  169.  
  170.     * Modularity and reusability
  171.          The Perl library is now defined in terms of modules which
  172.          can be easily shared among various packages. A package may
  173.          choose to import all or a portion of a module's published
  174.          interface. Pragmas (that is, compiler directives) are
  175.          defined and used by the same mechanism.
  176.  
  177.     * Object-oriented programming
  178.          A package can function as a class. Dynamic multiple
  179.          inheritance and virtual methods are supported in a
  180.          straightforward manner and with very little new syntax.
  181.          Filehandles may now be treated as objects.
  182.  
  183.     * Embeddable and Extensible
  184.          Perl may now be embedded easily in your C or C++
  185.          application, and can either call or be called by your
  186.          routines through a documented interface. The XS
  187.          preprocessor is provided to make it easy to glue your C or
  188.          C++ routines into Perl. Dynamic loading of modules is
  189.          supported, and Perl itself can be made into a dynamic
  190.          library.
  191.  
  192.     * POSIX compliant
  193.          A major new module is the POSIX module, which provides
  194.          access to all available POSIX routines and definitions, via
  195.          object classes where appropriate.
  196.  
  197.     * Package constructors and destructors
  198.          The new BEGIN and END blocks provide means to capture
  199.          control as a package is being compiled, and after the
  200.          program exits. As a degenerate case they work just like
  201.          awk's BEGIN and END when you use the -p or -n switches.
  202.  
  203.     * Multiple simultaneous DBM implementations
  204.          A Perl program may now access DBM, NDBM, SDBM, GDBM, and
  205.          Berkeley DB files from the same script simultaneously. In
  206.          fact, the old dbmopen interface has been generalized to
  207.          allow any variable to be tied to an object class which
  208.          defines its access methods.
  209.  
  210.     * Subroutine definitions may now be autoloaded
  211.          In fact, the AUTOLOAD mechanism also allows you to define
  212.          any arbitrary semantics for undefined subroutine calls.
  213.          It's not for just autoloading.
  214.  
  215.     * Regular expression enhancements
  216.          You can now specify nongreedy quantifiers. You can now do
  217.          grouping without creating a backreference. You can now
  218.          write regular expressions with embedded whitespace and
  219.          comments for readability. A consistent extensibility
  220.          mechanism has been added that is upwardly compatible with
  221.          all old regular expressions.
  222.  
  223.     * Innumerable Unbundled Modules
  224.          The Comprehensive Perl Archive Network described in the
  225.          perlmodlib manpage contains hundreds of plug-and-play
  226.          modules full of reusable code. See http://www.perl.com/CPAN
  227.          for a site near you.
  228.  
  229.     * Compilability
  230.          While not yet in full production mode, a working perl-to-C
  231.          compiler does exist. It can generate portable byte code,
  232.          simple C, or optimized C code.
  233.  
  234.  
  235.     Okay, that's *definitely* enough hype.
  236.  
  237. AVAILABILITY
  238.     Perl is available for the vast majority of operating system
  239.     platforms, including most Unix-like platforms. The following
  240.     situation is as of February 1999 and Perl 5.005_03.
  241.  
  242.     The following platforms are able to build Perl from the standard
  243.     source code distribution available at
  244.     http://www.perl.com/CPAN/src/index.html
  245.  
  246.             AIX             Linux           SCO ODT/OSR
  247.             A/UX            MachTen         Solaris
  248.             BeOS            MPE/iX          SunOS
  249.             BSD/OS          NetBSD          SVR4
  250.             DG/UX           NextSTEP        Tru64 UNIX      3)
  251.             DomainOS        OpenBSD         Ultrix
  252.             DOS DJGPP 1)    OpenSTEP        UNICOS
  253.             DYNIX/ptx       OS/2            VMS
  254.             FreeBSD         OS390     2)    VOS
  255.             HP-UX           PowerMAX        Windows 3.1     1)
  256.             Hurd            QNX             Windows 95      1) 4)
  257.             IRIX                            Windows 98      1) 4)
  258.                                             Windows NT      1) 4)
  259.  
  260.             1) in DOS mode either the DOS or OS/2 ports can be used
  261.             2) formerly known as MVS
  262.             3) formerly known as Digital UNIX and before that DEC OSF/1
  263.             4) compilers: Borland, Cygwin32, Mingw32 EGCS/GCC, VC++
  264.  
  265.  
  266.     The following platforms have been known to build Perl from the
  267.     source but for the Perl release 5.005_03 we haven't been able to
  268.     verify them, either because the hardware/software platforms are
  269.     rather rare or because we don't have an active champion on these
  270.     platforms, or both.
  271.  
  272.             3b1             FPS             Plan 9
  273.             AmigaOS         GENIX           PowerUX
  274.             ConvexOS        Greenhills      RISC/os
  275.             CX/UX           ISC             Stellar
  276.             DC/OSx          MachTen 68k     SVR2
  277.             DDE SMES        MiNT            TI1500
  278.             DOS EMX         MPC             TitanOS
  279.             Dynix           NEWS-OS         UNICOS/mk
  280.             EP/IX           Opus            Unisys Dynix
  281.             ESIX                Unixware
  282.  
  283.  
  284.     The following platforms are planned to be supported in the
  285.     standard source code distribution of the Perl release 5.006 but
  286.     are not supported in the Perl release 5.005_03:
  287.  
  288.             BS2000
  289.         Netware
  290.         Rhapsody
  291.             VM/ESA
  292.  
  293.  
  294.     The following platforms have their own source code distributions
  295.     and binaries available via
  296.     http://www.perl.com/CPAN/ports/index.html.
  297.  
  298.                     Perl release
  299.  
  300.         AS/400            5.003
  301.         MacOS            5.004
  302.         Netware            5.003_07
  303.         Tandem Guardian        5.004
  304.  
  305.  
  306.     The following platforms have only binaries available via
  307.     http://www.perl.com/CPAN/ports/index.html.
  308.  
  309.                     Perl release
  310.  
  311.         Acorn RISCOS        5.005_02
  312.         AOS            5.002
  313.         LynxOS            5.004_02
  314.  
  315.  
  316. ENVIRONMENT
  317.     See the perlrun manpage.
  318.  
  319. AUTHOR
  320.     Larry Wall <larry@wall.org>, with the help of oodles of other
  321.     folks.
  322.  
  323.     If your Perl success stories and testimonials may be of help to
  324.     others who wish to advocate the use of Perl in their
  325.     applications, or if you wish to simply express your gratitude to
  326.     Larry and the Perl developers, please write to <perl-
  327.     thanks@perl.org>.
  328.  
  329. FILES
  330.      "@INC"            locations of perl libraries
  331.  
  332.  
  333. SEE ALSO
  334.      a2p    awk to perl translator
  335.  
  336.      s2p    sed to perl translator
  337.  
  338.  
  339. DIAGNOSTICS
  340.     The -w switch produces some lovely diagnostics.
  341.  
  342.     See the perldiag manpage for explanations of all Perl's
  343.     diagnostics. The `use diagnostics' pragma automatically turns
  344.     Perl's normally terse warnings and errors into these longer
  345.     forms.
  346.  
  347.     Compilation errors will tell you the line number of the error,
  348.     with an indication of the next token or token type that was to
  349.     be examined. (In the case of a script passed to Perl via -e
  350.     switches, each -e is counted as one line.)
  351.  
  352.     Setuid scripts have additional constraints that can produce
  353.     error messages such as "Insecure dependency". See the perlsec
  354.     manpage.
  355.  
  356.     Did we mention that you should definitely consider using the -w
  357.     switch?
  358.  
  359. BUGS
  360.     The -w switch is not mandatory.
  361.  
  362.     Perl is at the mercy of your machine's definitions of various
  363.     operations such as type casting, atof(), and floating-point
  364.     output with sprintf().
  365.  
  366.     If your stdio requires a seek or eof between reads and writes on
  367.     a particular stream, so does Perl. (This doesn't apply to
  368.     sysread() and syswrite().)
  369.  
  370.     While none of the built-in data types have any arbitrary size
  371.     limits (apart from memory size), there are still a few arbitrary
  372.     limits: a given variable name may not be longer than 251
  373.     characters. Line numbers displayed by diagnostics are internally
  374.     stored as short integers, so they are limited to a maximum of
  375.     65535 (higher numbers usually being affected by wraparound).
  376.  
  377.     You may mail your bug reports (be sure to include full
  378.     configuration information as output by the myconfig program in
  379.     the perl source tree, or by `perl -V') to <perlbug@perl.com>. If
  380.     you've succeeded in compiling perl, the perlbug script in the
  381.     utils/ subdirectory can be used to help mail in a bug report.
  382.  
  383.     Perl actually stands for Pathologically Eclectic Rubbish Lister,
  384.     but don't tell anyone I said that.
  385.  
  386. NOTES
  387.     The Perl motto is "There's more than one way to do it." Divining
  388.     how many more is left as an exercise to the reader.
  389.  
  390.     The three principal virtues of a programmer are Laziness,
  391.     Impatience, and Hubris. See the Camel Book for why.
  392.  
  393.