perl - Practical Extraction and Report Language


NAME

perl - Practical Extraction and Report Language

__top


SYNOPSIS

perl-sTuU ] [ -hv ] [ -V[:configvar] ] [ -cw ] [ -d[:debugger] ] [ -D[number/list] ] [ -pna ] [ -Fpattern ] [ -l[octal] ] [ -0[octal] ] [ -Idir ] [ -m[-]module ] [ -M[-]'module...' ] [ -P ] [ -S ] [ -x[dir] ] [ -i[extension] ] [ -e 'command' ]      [ -- ] [ programfile ] [ argument ]...

If you're new to Perl, you should start with the perlintro manpage, which is a general intro for beginners and provides some background to help you navigate the rest of Perl's extensive documentation.

For ease of access, the Perl manual has been split up into several sections.

Overview

    perl                Perl overview (this section)
    file://D:/temp/Perl/html/lib/Pod/perlintro.pod:">perlintro           Perl introduction for beginners
    file://D:/temp/Perl/html/lib/Pod/perltoc.pod:">perltoc             Perl documentation table of contents

Tutorials

    file://D:/temp/Perl/html/lib/Pod/perlreftut.pod:">perlreftut          Perl references short introduction
    file://D:/temp/Perl/html/lib/Pod/perldsc.pod:">perldsc             Perl data structures intro
    file://D:/temp/Perl/html/lib/Pod/perllol.pod:">perllol             Perl data structures: arrays of arrays
    file://D:/temp/Perl/html/lib/Pod/perlrequick.pod:">perlrequick         Perl regular expressions quick start
    file://D:/temp/Perl/html/lib/Pod/perlretut.pod:">perlretut           Perl regular expressions tutorial
    file://D:/temp/Perl/html/lib/Pod/perlboot.pod:">perlboot            Perl OO tutorial for beginners
    file://D:/temp/Perl/html/lib/Pod/perltoot.pod:">perltoot            Perl OO tutorial, part 1
    file://D:/temp/Perl/html/lib/Pod/perltooc.pod:">perltooc            Perl OO tutorial, part 2
    file://D:/temp/Perl/html/lib/Pod/perlbot.pod:">perlbot             Perl OO tricks and examples
    file://D:/temp/Perl/html/lib/Pod/perlstyle.pod:">perlstyle           Perl style guide
    file://D:/temp/Perl/html/lib/Pod/perltrap.pod:">perltrap            Perl traps for the unwary
    file://D:/temp/Perl/html/lib/Pod/perldebtut.pod:">perldebtut          Perl debugging tutorial
    file://D:/temp/Perl/html/lib/Pod/perlfaq.pod:">perlfaq             Perl frequently asked questions
      file://D:/temp/Perl/html/lib/Pod/perlfaq1.pod:">perlfaq1          General Questions About Perl
      file://D:/temp/Perl/html/lib/Pod/perlfaq2.pod:">perlfaq2          Obtaining and Learning about Perl
      file://D:/temp/Perl/html/lib/Pod/perlfaq3.pod:">perlfaq3          Programming Tools
      file://D:/temp/Perl/html/lib/Pod/perlfaq4.pod:">perlfaq4          Data Manipulation
      file://D:/temp/Perl/html/lib/Pod/perlfaq5.pod:">perlfaq5          Files and Formats
      file://D:/temp/Perl/html/lib/Pod/perlfaq6.pod:">perlfaq6          Regexes
      file://D:/temp/Perl/html/lib/Pod/perlfaq7.pod:">perlfaq7          Perl Language Issues
      file://D:/temp/Perl/html/lib/Pod/perlfaq8.pod:">perlfaq8          System Interaction
      file://D:/temp/Perl/html/lib/Pod/perlfaq9.pod:">perlfaq9          Networking

Reference Manual

    file://D:/temp/Perl/html/lib/Pod/perlsyn.pod:">perlsyn             Perl syntax
    file://D:/temp/Perl/html/lib/Pod/perldata.pod:">perldata            Perl data structures
    file://D:/temp/Perl/html/lib/Pod/perlop.pod:">perlop              Perl operators and precedence
    file://D:/temp/Perl/html/lib/Pod/perlsub.pod:">perlsub             Perl subroutines
    file://D:/temp/Perl/html/lib/Pod/perlfunc.pod:">perlfunc            Perl built-in functions
      file://D:/temp/Perl/html/lib/Pod/perlopentut.pod:">perlopentut       Perl open() tutorial
      file://D:/temp/Perl/html/lib/Pod/perlpacktut.pod:">perlpacktut       Perl pack() and unpack() tutorial
    file://D:/temp/Perl/html/lib/Pod/perlpod.pod:site/lib/perlpod.pod:">perlpod             Perl plain old documentation
    file://D:/temp/Perl/html/lib/Pod/perlpodspec.pod:site/lib/perlpodspec.pod:">perlpodspec         Perl plain old documentation format specification
    file://D:/temp/Perl/html/lib/Pod/perlrun.pod:">perlrun             Perl execution and options
    file://D:/temp/Perl/html/lib/Pod/perldiag.pod:">perldiag            Perl diagnostic messages
    file://D:/temp/Perl/html/lib/Pod/perllexwarn.pod:">perllexwarn         Perl warnings and their control
    file://D:/temp/Perl/html/lib/Pod/perldebug.pod:">perldebug           Perl debugging
    file://D:/temp/Perl/html/lib/Pod/perlvar.pod:">perlvar             Perl predefined variables
    file://D:/temp/Perl/html/lib/Pod/perlre.pod:">perlre              Perl regular expressions, the rest of the story
    file://D:/temp/Perl/html/lib/Pod/perlref.pod:">perlref             Perl references, the rest of the story
    file://D:/temp/Perl/html/lib/Pod/perlform.pod:">perlform            Perl formats
    file://D:/temp/Perl/html/lib/Pod/perlobj.pod:">perlobj             Perl objects
    file://D:/temp/Perl/html/lib/Pod/perltie.pod:">perltie             Perl objects hidden behind simple variables
      file://D:/temp/Perl/html/lib/Pod/perldbmfilter.pod:">perldbmfilter     Perl DBM filters
    file://D:/temp/Perl/html/lib/Pod/perlipc.pod:">perlipc             Perl interprocess communication
    file://D:/temp/Perl/html/lib/Pod/perlfork.pod:">perlfork            Perl fork() information
    file://D:/temp/Perl/html/lib/Pod/perlnumber.pod:">perlnumber          Perl number semantics
    file://D:/temp/Perl/html/lib/Pod/perlthrtut.pod:">perlthrtut          Perl threads tutorial
      file://D:/temp/Perl/html/lib/Pod/perlothrtut.pod:">perlothrtut         Old Perl threads tutorial
    file://D:/temp/Perl/html/lib/Pod/perlport.pod:">perlport            Perl portability guide
    file://D:/temp/Perl/html/lib/Pod/perllocale.pod:">perllocale          Perl locale support
    file://D:/temp/Perl/html/lib/Pod/perluniintro.pod:">perluniintro        Perl Unicode introduction
    file://D:/temp/Perl/html/lib/Pod/perlunicode.pod:">perlunicode         Perl Unicode support
    file://D:/temp/Perl/html/lib/Pod/perlebcdic.pod:">perlebcdic          Considerations for running Perl on EBCDIC platforms
    file://D:/temp/Perl/html/lib/Pod/perlsec.pod:">perlsec             Perl security
    file://D:/temp/Perl/html/lib/Pod/perlmod.pod:">perlmod             Perl modules: how they work
    file://D:/temp/Perl/html/lib/Pod/perlmodlib.pod:">perlmodlib          Perl modules: how to write and use
    file://D:/temp/Perl/html/lib/Pod/perlmodstyle.pod:">perlmodstyle        Perl modules: how to write modules with style
    file://D:/temp/Perl/html/lib/Pod/perlmodinstall.pod:">perlmodinstall      Perl modules: how to install from CPAN
    file://D:/temp/Perl/html/lib/Pod/perlnewmod.pod:">perlnewmod          Perl modules: preparing a new module for distribution
    file://D:/temp/Perl/html/lib/Pod/perlutil.pod:">perlutil            utilities packaged with the Perl distribution
    file://D:/temp/Perl/html/lib/Pod/perlcompile.pod:">perlcompile         Perl compiler suite intro
    file://D:/temp/Perl/html/lib/Pod/perlfilter.pod:">perlfilter          Perl source filters

Internals and C Language Interface

    file://D:/temp/Perl/html/lib/Pod/perlembed.pod:">perlembed           Perl ways to embed perl in your C or C++ application
    file://D:/temp/Perl/html/lib/Pod/perldebguts.pod:">perldebguts         Perl debugging guts and tips
    file://D:/temp/Perl/html/lib/Pod/perlxstut.pod:">perlxstut           Perl XS tutorial
    file://D:/temp/Perl/html/lib/Pod/perlxs.pod:">perlxs              Perl XS application programming interface
    file://D:/temp/Perl/html/lib/Pod/perlclib.pod:">perlclib            Internal replacements for standard C library functions
    file://D:/temp/Perl/html/lib/Pod/perlguts.pod:">perlguts            Perl internal functions for those doing extensions
    file://D:/temp/Perl/html/lib/Pod/perlcall.pod:">perlcall            Perl calling conventions from C
    file://D:/temp/Perl/html/lib/Pod/perlapi.pod:">perlapi             Perl API listing (autogenerated)
    file://D:/temp/Perl/html/lib/Pod/perlintern.pod:">perlintern          Perl internal functions (autogenerated)
    file://D:/temp/Perl/html/lib/Pod/perliol.pod:">perliol             C API for Perl's implementation of IO in Layers
    file://D:/temp/Perl/html/lib/Pod/perlapio.pod:">perlapio            Perl internal IO abstraction interface
    file://D:/temp/Perl/html/lib/Pod/perlhack.pod:">perlhack            Perl hackers guide

Miscellaneous

    file://D:/temp/Perl/html/lib/Pod/perlbook.pod:">perlbook            Perl book information
    file://D:/temp/Perl/html/lib/Pod/perltodo.pod:">perltodo            Perl things to do
    file://D:/temp/Perl/html/lib/Pod/perlhist.pod:">perlhist            Perl history records
    file://D:/temp/Perl/html/lib/Pod/perldelta.pod:">perldelta           Perl changes since previous version
    file://D:/temp/Perl/html/lib/Pod/perl572delta.pod:">perl572delta        Perl changes in version 5.7.2
    file://D:/temp/Perl/html/lib/Pod/perl571delta.pod:">perl571delta        Perl changes in version 5.7.1
    file://D:/temp/Perl/html/lib/Pod/perl570delta.pod:">perl570delta        Perl changes in version 5.7.0
    file://D:/temp/Perl/html/lib/Pod/perl561delta.pod:">perl561delta        Perl changes in version 5.6.1
    file://D:/temp/Perl/html/lib/Pod/perl56delta.pod:">perl56delta         Perl changes in version 5.6
    file://D:/temp/Perl/html/lib/Pod/perl5005delta.pod:">perl5005delta       Perl changes in version 5.005
    file://D:/temp/Perl/html/lib/Pod/perl5004delta.pod:">perl5004delta       Perl changes in version 5.004

Language-Specific

    perlcn              Perl for Simplified Chinese (in EUC-CN)
    perljp              Perl for Japanese (in EUC-JP)
    perlko              Perl for Korean (in EUC-KR)
    perltw              Perl for Traditional Chinese (in Big5)

Platform-Specific

    file://D:/temp/Perl/html/lib/Pod/perlaix.pod:">perlaix             Perl notes for AIX
    file://D:/temp/Perl/html/lib/Pod/perlamiga.pod:">perlamiga           Perl notes for AmigaOS
    file://D:/temp/Perl/html/lib/Pod/perlapollo.pod:">perlapollo          Perl notes for Apollo DomainOS
    file://D:/temp/Perl/html/lib/Pod/perlbeos.pod:">perlbeos            Perl notes for BeOS
    file://D:/temp/Perl/html/lib/Pod/perlbs2000.pod:">perlbs2000          Perl notes for POSIX-BC BS2000
    file://D:/temp/Perl/html/lib/Pod/perlce.pod:">perlce              Perl notes for WinCE
    file://D:/temp/Perl/html/lib/Pod/perlcygwin.pod:">perlcygwin          Perl notes for Cygwin
    file://D:/temp/Perl/html/lib/Pod/perldgux.pod:">perldgux            Perl notes for DG/UX
    file://D:/temp/Perl/html/lib/Pod/perldos.pod:">perldos             Perl notes for DOS
    file://D:/temp/Perl/html/lib/Pod/perlepoc.pod:">perlepoc            Perl notes for EPOC
    file://D:/temp/Perl/html/lib/Pod/perlfreebsd.pod:">perlfreebsd         Perl notes for FreeBSD
    file://D:/temp/Perl/html/lib/Pod/perlhpux.pod:">perlhpux            Perl notes for HP-UX
    file://D:/temp/Perl/html/lib/Pod/perlhurd.pod:">perlhurd            Perl notes for Hurd
    file://D:/temp/Perl/html/lib/Pod/perlirix.pod:">perlirix            Perl notes for Irix
    file://D:/temp/Perl/html/lib/Pod/perlmachten.pod:">perlmachten         Perl notes for Power MachTen
    file://D:/temp/Perl/html/lib/Pod/perlmacos.pod:">perlmacos           Perl notes for Mac OS (Classic)
    file://D:/temp/Perl/html/lib/Pod/perlmint.pod:">perlmint            Perl notes for MiNT
    file://D:/temp/Perl/html/lib/Pod/perlmpeix.pod:">perlmpeix           Perl notes for MPE/iX
    file://D:/temp/Perl/html/lib/Pod/perlnetware.pod:">perlnetware         Perl notes for NetWare
    file://D:/temp/Perl/html/lib/Pod/perlos2.pod:">perlos2             Perl notes for OS/2
    file://D:/temp/Perl/html/lib/Pod/perlos390.pod:">perlos390           Perl notes for OS/390
    file://D:/temp/Perl/html/lib/Pod/perlplan9.pod:">perlplan9           Perl notes for Plan 9
    file://D:/temp/Perl/html/lib/Pod/perlqnx.pod:">perlqnx             Perl notes for QNX
    file://D:/temp/Perl/html/lib/Pod/perlsolaris.pod:">perlsolaris         Perl notes for Solaris
    file://D:/temp/Perl/html/lib/Pod/perltru64.pod:">perltru64           Perl notes for Tru64
    file://D:/temp/Perl/html/lib/Pod/perluts.pod:">perluts             Perl notes for UTS
    file://D:/temp/Perl/html/lib/Pod/perlvmesa.pod:">perlvmesa           Perl notes for VM/ESA
    file://D:/temp/Perl/html/lib/Pod/perlvms.pod:">perlvms             Perl notes for VMS
    file://D:/temp/Perl/html/lib/Pod/perlvos.pod:">perlvos             Perl notes for Stratus VOS
    file://D:/temp/Perl/html/lib/Pod/perlwin32.pod:">perlwin32           Perl notes for Windows

By default, the manpages listed above are installed in the /usr/local/man/ directory.

Extensive additional documentation for Perl modules is available. The default configuration for perl will place this additional documentation in the /usr/local/lib/perl5/man directory (or else in the man 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.

You should be able to view Perl's documentation with your man(1) 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:

    perl -V:man.dir

If the directories have a common stem, such as /usr/local/man/man1 and /usr/local/man/man3, you need only to add that stem (/usr/local/man) to your man(1) configuration files or your MANPATH environment variable. If they do not share a stem, you'll have to add both stems.

If that doesn't work for some reason, you can still use the supplied perldoc script to view module information. You might also look into getting a replacement man program.

If something strange has gone wrong with your program and you're not sure where you should look for help, try the -w switch first. It will often point out exactly where the trouble is.

__top


DESCRIPTION

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).

Perl combines (in the author's opinion, anyway) some of the best features of C, sed, awk, and sh, so people familiar with those languages should have little difficulty with it. (Language historians will also note some vestiges of csh, 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 ``associative arrays'') 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.

If you have a problem that would ordinarily use sed or awk or sh, 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 sed and awk scripts into Perl scripts.

But wait, there's more...

Begun in 1993 (see the perlhist manpage), Perl version 5 is nearly a complete rewrite that provides the following additional benefits:

Okay, that's definitely enough hype.

__top


AVAILABILITY

Perl is available for most operating systems, including virtually all Unix-like platforms. See Supported Platforms in the perlport manpage for a listing.

__top


ENVIRONMENT

See the perlrun manpage.

__top


AUTHOR

Larry Wall <larry@wall.org>, with the help of oodles of other folks.

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 perl-thanks@perl.org .

__top


FILES

 "@INC"                 locations of perl libraries

__top


SEE ALSO

 a2p    awk to perl translator
 s2p    sed to perl translator
 http://www.perl.com/       the Perl Home Page
 http://www.cpan.org/       the Comprehensive Perl Archive
 http://www.perl.org/       Perl Mongers (Perl user groups)

__top


DIAGNOSTICS

The use warnings pragma (and the -w switch) produces some lovely diagnostics.

See the perldiag manpage for explanations of all Perl's diagnostics. The use diagnostics pragma automatically turns Perl's normally terse warnings and errors into these longer forms.

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 -e switches, each -e is counted as one line.)

Setuid scripts have additional constraints that can produce error messages such as ``Insecure dependency''. See the perlsec manpage.

Did we mention that you should definitely consider using the -w switch?

__top


BUGS

The -w switch is not mandatory.

Perl is at the mercy of your machine's definitions of various operations such as type casting, atof(), and floating-point output with sprintf().

If your stdio requires a seek or eof between reads and writes on a particular stream, so does Perl. (This doesn't apply to sysread() and syswrite().)

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).

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 perl -V) to perlbug@perl.org . If you've succeeded in compiling perl, the perlbug script in the utils/ subdirectory can be used to help mail in a bug report.

Perl actually stands for Pathologically Eclectic Rubbish Lister, but don't tell anyone I said that.

__top


NOTES

The Perl motto is ``There's more than one way to do it.'' Divining how many more is left as an exercise to the reader.

The three principal virtues of a programmer are Laziness, Impatience, and Hubris. See the Camel Book for why.

__top

 perl - Practical Extraction and Report Language