Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

2908 lines
110 KiB

<HTML>
<HEAD>
<TITLE>Rex Swain's HTMLified Perl 5 Reference Guide</TITLE>
<META NAME="description" CONTENT="Perl 5 Reference Guide (in HTML)">
<META NAME="keywords" CONTENT="perl, reference, summary">
</HEAD>
<BODY>
<A NAME="top"></A>
<CENTER>
<H1>Rex Swain's HTMLified<BR>Perl 5 Reference Guide</H1>
<P>Last updated 17 May 1997</P>
<P>[ The <A HREF="http://www.pcnet.com/~rhswain/perl.html">original</A> ]
&nbsp;
[ <A HREF="http://www.man.ac.uk/~mbzalgd/perl/perl5-ref.html">.UK Mirror</A>
via <A HREF="http://www.man.ac.uk/~mbzalgd">Alain Deckers</A> ]
&nbsp;
[ <A HREF="http://www.cs.uni-magdeburg.de/docs/perl5/index.html">.DE Mirror</A>
via <A HREF="http://irb.cs.uni-magdeburg.de/~elkner">Jens Elkner</A> ]
</P>
</CENTER>
<H4 ALIGN=center>Jump to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<CENTER>
<TABLE BORDER=4 CELLPADDING=8><TR><TD>
<CENTER>
<H3><FONT COLOR="#FF0000">Please make a local copy of this HTML document!</FONT></H3>
<P>Use your browser's <STRONG><U>F</U>ile, Save <U>A</U>s...</STRONG> command
<BR>or I will get charged by my ISP for excessive bandwidth use.</P>
Thank you!
</CENTER>
</TR></TD></TABLE>
</CENTER>
<P>This is an HTMLified version of the <I>Perl 5 Desktop Reference</I>,
ISBN 1-56592-187-9, copyright &copy; 1996 by
<A HREF="http://www.xs4all.nl/~jvromans/">Johan Vromans</A>.
HTML copyright &copy; 1996-1997 by
<A HREF="http://www.pcnet.com/~rhswain/">Rex Swain</A>.</P>
<P>See <A HREF="http://www.pcnet.com/~rhswain/perl4.html">Rex Swain's HTMLified Perl 4 Reference Guide</A>
for similar summary of Perl version 4.</P>
<P>See <A HREF="http://www.ora.com/catalog/perlqr/">Perl 5 Desktop Reference</A>
for information about ordering a printed copy ($6.95) of the booklet from O'Reilly.
See <A HREF="http://www.xs4all.nl/~jvromans/perlref.html">The Perl Reference Guide</A>
for pointers to a PostScript (free) version.</P>
<P>If you want to learn Perl, see the book
<A HREF="http://www.ora.com/catalog/lperl/">Learning Perl</A>
by Randal L. Schwartz. If you want more detailed information about Perl, see the book
<A HREF="http://www.ora.com/catalog/pperl/">Programming perl</A>
by Larry Wall and Randal L. Schwartz.</P>
<P>For more detail, see <A HREF="http://www.mit.edu/perl/perl.html">Perl Manual</A>
or <A HREF="ftp://ftp.digital.com/pub/plan/perl/CPAN/doc/manual/html/perlfunc.html#perlfunc_alphabetical_0">Alphabetical Listing of Perl Functions</A>.
<BR>For less detail, see <A HREF="http://www.perl.com/perl/">The Perl Language Home Page</A>.</P>
<H4 ALIGN=center>Jump to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="contents"></A>
<H2>Contents</H2>
<TABLE>
<TR><TD><UL>
<LI><A HREF="#conventions">Conventions</A>
</UL></TD></TR>
<TR><TD><UL>
<LI><A HREF="#options">Command-Line Options</A>
<LI><A HREF="#literals">Literals</A>
<LI><A HREF="#variables">Variables</A>
<LI><A HREF="#operators">Operators</A>
<LI><A HREF="#statements">Statements</A>
<LI><A HREF="#subroutines">Subroutines, Packages and Modules</A>
<LI><A HREF="#object">Object-Oriented Programming</A>
<LI><A HREF="#arithmetic">Arithmetic Functions</A>
<LI><A HREF="#conversion">Conversion Functions</A>
<LI><A HREF="#structure">Structure Conversion</A>
<LI><A HREF="#string">String Functions</A>
<LI><A HREF="#array">Array and List Functions</A>
<LI><A HREF="#regular">Regular Expressions</A>
<LI><A HREF="#search">Search and Replace Functions</A>
</UL></TD>
<TD><UL>
<LI><A HREF="#filetest">File Test Operators</A>
<LI><A HREF="#fileoperations">File Operations</A>
<LI><A HREF="#input">Input / Output</A>
<LI><A HREF="#formats">Formats</A>
<LI><A HREF="#directory">Directory Reading Routines</A>
<LI><A HREF="#systeminteraction">System Interaction</A>
<LI><A HREF="#networking">Networking</A>
<LI><A HREF="#systemv">System V IPC</A>
<LI><A HREF="#miscellaneous">Miscellaneous</A>
<LI><A HREF="#information">Information from System Files</A>
<LI><A HREF="#specialvariables">Special Variables</A>
<LI><A HREF="#specialarrays">Special Arrays</A>
<LI><A HREF="#environment">Environment Variables</A>
<LI><A HREF="#debugger">The Perl Debugger</A>
</UL></TD></TR>
</TABLE>
<H4 ALIGN=center>Jump to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="index"></A>
<H2>Index</H2>
<A HREF="#arithmetic">abs</A>&nbsp;
<A HREF="#networking">accept</A>&nbsp;
<A HREF="#systeminteraction">alarm</A>&nbsp;
<A HREF="#operators">and</A>&nbsp;
<A HREF="#specialarrays">ARGV</A>&nbsp;
<A HREF="#arithmetic">ArithmeticFunctions</A>&nbsp;
<A HREF="#array">ArrayListFunctions</A>&nbsp;
<A HREF="#specialarrays">ArraysSpecial</A>&nbsp;
<A HREF="#arithmetic">atan2</A>&nbsp;
<A HREF="#subroutines">BEGIN</A>&nbsp;
<A HREF="#networking">bind</A>&nbsp;
<A HREF="#input">binmode</A>&nbsp;
<A HREF="#subroutines">bless</A>&nbsp;
<A HREF="#subroutines">caller</A>&nbsp;
<A HREF="#systeminteraction">chdir</A>&nbsp;
<A HREF="#fileoperations">chmod</A>&nbsp;
<A HREF="#string">chomp</A>&nbsp;
<A HREF="#string">chop</A>&nbsp;
<A HREF="#conversion">chr</A>&nbsp;
<A HREF="#systeminteraction">chroot</A>&nbsp;
<A HREF="#input">close</A>&nbsp;
<A HREF="#directory">closedir</A>&nbsp;
<A HREF="#operators">cmp</A>&nbsp;
<A HREF="#options">CommandLineOptions</A>&nbsp;
<A HREF="#networking">connect</A>&nbsp;
<A HREF="#contents">Contents</A>&nbsp;
<A HREF="#statements">continue</A>&nbsp;
<A HREF="#conventions">Conventions</A>&nbsp;
<A HREF="#conversion">ConversionFunctions</A>&nbsp;
<A HREF="#structure">ConversionStructure</A>&nbsp;
<A HREF="#arithmetic">cos</A>&nbsp;
<A HREF="#string">crypt</A>&nbsp;
<A HREF="#input">dbmclose</A>&nbsp;
<A HREF="#input">dbmopen</A>&nbsp;
<A HREF="#debugger">Debugger</A>&nbsp;
<A HREF="#miscellaneous">defined</A>&nbsp;
<A HREF="#array">delete</A>&nbsp;
<A HREF="#systeminteraction">die</A>&nbsp;
<A HREF="#directory">DirectoryReadingRoutines</A>&nbsp;
<A HREF="#statements">do</A>&nbsp;
<A HREF="#subroutines">do</A>&nbsp;
<A HREF="#miscellaneous">do</A>&nbsp;
<A HREF="#miscellaneous">dump</A>&nbsp;
<A HREF="#array">each</A>&nbsp;
<A HREF="#statements">else</A>&nbsp;
<A HREF="#statements">elsif</A>&nbsp;
<A HREF="#subroutines">END</A>&nbsp;
<A HREF="#specialarrays">ENV</A>&nbsp;
<A HREF="#environment">EnvironmentVariables</A>&nbsp;
<A HREF="#input">eof</A>&nbsp;
<A HREF="#operators">eq</A>&nbsp;
<A HREF="#string">eval</A>&nbsp;
<A HREF="#miscellaneous">eval</A>&nbsp;
<A HREF="#systeminteraction">exec</A>&nbsp;
<A HREF="#array">exists</A>&nbsp;
<A HREF="#systeminteraction">exit</A>&nbsp;
<A HREF="#arithmetic">exp</A>&nbsp;
<A HREF="#specialarrays">EXPORT</A>&nbsp;
<A HREF="#specialarrays">EXPORT_OK</A>&nbsp;
<A HREF="#regular">ExpressionsRegular</A>&nbsp;
<A HREF="#input">fcntl</A>&nbsp;
<A HREF="#input">fileno</A>&nbsp;
<A HREF="#fileoperations">FileOperations</A>&nbsp;
<A HREF="#information">FilesSystemInformationFrom</A>&nbsp;
<A HREF="#filetest">FileTestOperators</A>&nbsp;
<A HREF="#input">flock</A>&nbsp;
<A HREF="#statements">for</A>&nbsp;
<A HREF="#statements">foreach</A>&nbsp;
<A HREF="#systeminteraction">fork</A>&nbsp;
<A HREF="#formats">Formats</A>&nbsp;
<A HREF="#formats">formline</A>&nbsp;
<A HREF="#arithmetic">FunctionsArithmetic</A>&nbsp;
<A HREF="#array">FunctionsArrayList</A>&nbsp;
<A HREF="#conversion">FunctionsConversion</A>&nbsp;
<A HREF="#search">FunctionsSearchReplace</A>&nbsp;
<A HREF="#string">FunctionsString</A>&nbsp;
<A HREF="#operators">ge</A>&nbsp;
<A HREF="#input">getc</A>&nbsp;
<A HREF="#systeminteraction">getlogin</A>&nbsp;
<A HREF="#networking">getpeername</A>&nbsp;
<A HREF="#systeminteraction">getpgrp</A>&nbsp;
<A HREF="#systeminteraction">getppid</A>&nbsp;
<A HREF="#systeminteraction">getpriority</A>&nbsp;
<A HREF="#networking">getsockname</A>&nbsp;
<A HREF="#networking">getsockopt</A>&nbsp;
<A HREF="#systeminteraction">glob</A>&nbsp;
<A HREF="#conversion">gmtime</A>&nbsp;
<A HREF="#statements">goto</A>&nbsp;
<A HREF="#subroutines">goto</A>&nbsp;
<A HREF="#array">grep</A>&nbsp;
<A HREF="#operators">gt</A>&nbsp;
<A HREF="#conversion">hex</A>&nbsp;
<A HREF="#environment">HOME</A>&nbsp;
<A HREF="#statements">if</A>&nbsp;
<A HREF="#subroutines">import</A>&nbsp;
<A HREF="#specialarrays">INC</A>&nbsp;
<A HREF="#index">Index</A>&nbsp;
<A HREF="#string">index</A>&nbsp;
<A HREF="#information">InformationFromSystemFiles</A>&nbsp;
<A HREF="#input">InputOutput</A>&nbsp;
<A HREF="#arithmetic">int</A>&nbsp;
<A HREF="#systeminteraction">InteractionSystem</A>&nbsp;
<A HREF="#input">ioctl</A>&nbsp;
<A HREF="#specialarrays">ISA</A>&nbsp;
<A HREF="#array">join</A>&nbsp;
<A HREF="#array">keys</A>&nbsp;
<A HREF="#systeminteraction">kill</A>&nbsp;
<A HREF="#statements">last</A>&nbsp;
<A HREF="#string">lc</A>&nbsp;
<A HREF="#string">lcfirst</A>&nbsp;
<A HREF="#operators">le</A>&nbsp;
<A HREF="#string">length</A>&nbsp;
<A HREF="#fileoperations">link</A>&nbsp;
<A HREF="#array">ListArrayFunctions</A>&nbsp;
<A HREF="#networking">listen</A>&nbsp;
<A HREF="#literals">Literals</A>&nbsp;
<A HREF="#miscellaneous">local</A>&nbsp;
<A HREF="#conversion">localtime</A>&nbsp;
<A HREF="#arithmetic">log</A>&nbsp;
<A HREF="#environment">LOGDIR</A>&nbsp;
<A HREF="#fileoperations">lstat</A>&nbsp;
<A HREF="#operators">lt</A>&nbsp;
<A HREF="#search">m</A>&nbsp;
<A HREF="#array">map</A>&nbsp;
<A HREF="#miscellaneous">Miscellaeous</A>&nbsp;
<A HREF="#fileoperations">mkdir</A>&nbsp;
<A HREF="#subroutines">Modules</A>&nbsp;
<A HREF="#miscellaneous">my</A>&nbsp;
<A HREF="#operators">ne</A>&nbsp;
<A HREF="#networking">Networking</A>&nbsp;
<A HREF="#statements">next</A>&nbsp;
<A HREF="#subroutines">no</A>&nbsp;
<A HREF="#operators">npt</A>&nbsp;
<A HREF="#object">ObjectOrientedProgramming</A>&nbsp;
<A HREF="#conversion">oct</A>&nbsp;
<A HREF="#input">open</A>&nbsp;
<A HREF="#directory">opendir</A>&nbsp;
<A HREF="#fileoperations">OperationsFile</A>&nbsp;
<A HREF="#operators">Operators</A>&nbsp;
<A HREF="#filetest">OperatorsFileTest</A>&nbsp;
<A HREF="#options">OptionsCommandLine</A>&nbsp;
<A HREF="#operators">or</A>&nbsp;
<A HREF="#conversion">ord</A>&nbsp;
<A HREF="#input">OutputInput</A>&nbsp;
<A HREF="#specialarrays">OVERLOAD</A>&nbsp;
<A HREF="#structure">pack</A>&nbsp;
<A HREF="#subroutines">package</A>&nbsp;
<A HREF="#subroutines">Packages</A>&nbsp;
<A HREF="#environment">PATH</A>&nbsp;
<A HREF="#environment">PERL5DB</A>&nbsp;
<A HREF="#environment">PERL5LIB</A>&nbsp;
<A HREF="#environment">PERLLIB</A>&nbsp;
<A HREF="#input">pipe</A>&nbsp;
<A HREF="#array">pop</A>&nbsp;
<A HREF="#search">pos</A>&nbsp;
<A HREF="#input">print</A>&nbsp;
<A HREF="#input">printf</A>&nbsp;
<A HREF="#array">push</A>&nbsp;
<A HREF="#string">quotemeta</A>&nbsp;
<A HREF="#arithmetic">rand</A>&nbsp;
<A HREF="#input">read</A>&nbsp;
<A HREF="#directory">readdir</A>&nbsp;
<A HREF="#directory">ReadingDirectoryRoutines</A>&nbsp;
<A HREF="#fileoperations">readlink</A>&nbsp;
<A HREF="#networking">recv</A>&nbsp;
<A HREF="#statements">redo</A>&nbsp;
<A HREF="#miscellaneous">ref</A>&nbsp;
<A HREF="#regular">RegularExpressions</A>&nbsp;
<A HREF="#fileoperations">rename</A>&nbsp;
<A HREF="#search">ReplaceSearchFunctions</A>&nbsp;
<A HREF="#subroutines">require</A>&nbsp;
<A HREF="#miscellaneous">reset</A>&nbsp;
<A HREF="#subroutines">return</A>&nbsp;
<A HREF="#array">reverse</A>&nbsp;
<A HREF="#directory">rewindir</A>&nbsp;
<A HREF="#string">rindex</A>&nbsp;
<A HREF="#fileoperations">rmdir</A>&nbsp;
<A HREF="#directory">RoutinesDirectoryReading</A>&nbsp;
<A HREF="#search">s</A>&nbsp;
<A HREF="#array">scalar</A>&nbsp;
<A HREF="#miscellaneous">scalar</A>&nbsp;
<A HREF="#search">SearchReplaceFunctions</A>&nbsp;
<A HREF="#input">seek</A>&nbsp;
<A HREF="#directory">seekdir</A>&nbsp;
<A HREF="#input">select</A>&nbsp;
<A HREF="#networking">send</A>&nbsp;
<A HREF="#systeminteraction">setpgrp</A>&nbsp;
<A HREF="#systeminteraction">setpriority</A>&nbsp;
<A HREF="#networking">setsockopt</A>&nbsp;
<A HREF="#array">shift</A>&nbsp;
<A HREF="#networking">shutdown</A>&nbsp;
<A HREF="#specialarrays">SIG</A>&nbsp;
<A HREF="#arithmetic">sin</A>&nbsp;
<A HREF="#systeminteraction">sleep</A>&nbsp;
<A HREF="#networking">socket</A>&nbsp;
<A HREF="#networking">socketpair</A>&nbsp;
<A HREF="#array">sort</A>&nbsp;
<A HREF="#specialarrays">SpecialArrays</A>&nbsp;
<A HREF="#specialvariables">SpecialVariables</A>&nbsp;
<A HREF="#array">splice</A>&nbsp;
<A HREF="#array">split</A>&nbsp;
<A HREF="#input">sprintf</A>&nbsp;
<A HREF="#arithmetic">sqrt</A>&nbsp;
<A HREF="#arithmetic">srand</A>&nbsp;
<A HREF="#fileoperations">stat</A>&nbsp;
<A HREF="#statements">Statements</A>&nbsp;
<A HREF="#string">StringFunctions</A>&nbsp;
<A HREF="#structure">StructureConversion</A>&nbsp;
<A HREF="#search">study</A>&nbsp;
<A HREF="#subroutines">sub</A>&nbsp;
<A HREF="#subroutines">Subroutines</A>&nbsp;
<A HREF="#string">substr</A>&nbsp;
<A HREF="#fileoperations">symlink</A>&nbsp;
<A HREF="#systeminteraction">syscall</A>&nbsp;
<A HREF="#input">sysread</A>&nbsp;
<A HREF="#systeminteraction">system</A>&nbsp;
<A HREF="#information">SystemFilesInformationFrom</A>&nbsp;
<A HREF="#systeminteraction">SystemInteraction</A>&nbsp;
<A HREF="#systemv">SystemVIPC</A>&nbsp;
<A HREF="#input">syswrite</A>&nbsp;
<A HREF="#input">tell</A>&nbsp;
<A HREF="#directory">telldir</A>&nbsp;
<A HREF="#filetest">TestFileOperators</A>&nbsp;
<A HREF="#subroutines">tie</A>&nbsp;
<A HREF="#arithmetic">time</A>&nbsp;
<A HREF="#systeminteraction">times</A>&nbsp;
<A HREF="#search">tr</A>&nbsp;
<A HREF="#fileoperations">truncate</A>&nbsp;
<A HREF="#string">uc</A>&nbsp;
<A HREF="#string">ucfirst</A>&nbsp;
<A HREF="#systeminteraction">umask</A>&nbsp;
<A HREF="#miscellaneous">undef</A>&nbsp;
<A HREF="#statements">unless</A>&nbsp;
<A HREF="#fileoperations">unlink</A>&nbsp;
<A HREF="#structure">unpack</A>&nbsp;
<A HREF="#array">unshift</A>&nbsp;
<A HREF="#subroutines">untie</A>&nbsp;
<A HREF="#statements">until</A>&nbsp;
<A HREF="#statements">until</A>&nbsp;
<A HREF="#subroutines">use</A>&nbsp;
<A HREF="#fileoperations">utime</A>&nbsp;
<A HREF="#array">values</A>&nbsp;
<A HREF="#variables">Variables</A>&nbsp;
<A HREF="#environment">VariablesEnvironment</A>&nbsp;
<A HREF="#specialvariables">VariablesSpecial</A>&nbsp;
<A HREF="#conversion">vec</A>&nbsp;
<A HREF="#systeminteraction">wait</A>&nbsp;
<A HREF="#systeminteraction">waitpid</A>&nbsp;
<A HREF="#miscellaneous">wantarray</A>&nbsp;
<A HREF="#systeminteraction">warn</A>&nbsp;
<A HREF="#statements">while</A>&nbsp;
<A HREF="#formats">write</A>&nbsp;
<A HREF="#operators">xor</A>&nbsp;
<A HREF="#search">y</A>&nbsp;
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="conventions"></A>
<H2>Conventions</H2>
<TABLE CELLSPACING=0 CELLPADDING=0>
<TR>
<TD><TT><B>fixed&nbsp;&nbsp;</B></TT></TD>
<TD>denotes literal text.</TD>
</TR>
<TR>
<TD><FONT SIZE="-1">THIS</FONT></TD>
<TD>means variable text, i.e., things you must fill in.</TD>
</TR>
<TR>
<TD><FONT SIZE="-1">THIS&#134;</FONT></TD>
<TD>means that <FONT SIZE="-1">THIS</FONT> will default to <TT><B>$_</B></TT> if omitted.</TD>
</TR>
<TR>
<TD><B>word</B></TD>
<TD>is a keyword, i.e., a word with a special meaning.</TD>
</TR>
<TR>
<TD><FONT SIZE="-1">RETURN key&nbsp;&nbsp;</FONT></TD>
<TD>denotes pressing a keyboard key.</TD>
</TR>
<TR>
<TD>[...]</TD>
<TD>denotes an optional part.</TD>
</TR>
</TABLE>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="options"></A>
<H2>Command-Line Options</H2>
<DL COMPACT>
<DT><TT><B>-a</B></TT>
<DD>turns on autosplit mode when used with <TT><B>-n</B></TT> or <TT><B>-p</B></TT>.
Splits to <TT><B>@F</B></TT>.
<DT><TT><B>-c</B></TT>
<DD>checks syntax but does not execute.
<DT><TT><B>-d</B></TT>
<DD>runs the script under the debugger.
Use <TT><B>-de 0</B></TT> to start the debugger without a script
<DT><TT><B>-D</B></TT> <FONT SIZE="-1">NUMBER</FONT>
<DD>sets debugging flags.
<DT><TT><B>-e</B></TT> <FONT SIZE="-1">COMMANDLINE</FONT>
<DD>may be used to enter a single line of script.
Multiple <TT><B>-e</B></TT> commands may be given to build up a multiline script.
<DT><TT><B>-F</B></TT> <FONT SIZE="-1">REGEXP</FONT>
<DD>specifies a regular expression to split on
if <TT><B>-a</B></TT> is in effect.
<DT><TT><B>-i</B></TT><FONT SIZE="-1">EXT</FONT>
<DD>files processed by the <TT><B>&lt; &gt;</B></TT> construct are
to be edited in place.
<DT><TT><B>-I</B></TT><FONT SIZE="-1">DIR</FONT>
<DD>with <TT><B>-P</B></TT>, tells the C preprocessor where to look for include files.
The directory is prepended to <TT><B>@INC</B></TT>.
<DT><TT><B>-l</B></TT> [<FONT SIZE="-1">OCTNUM</FONT>]
<DD>enables automatic line-end processing, e.g., <TT><B>-l013</B></TT>.
<DT><TT><B>-n</B></TT>
<DD>assumes an input loop around your script. Lines are not printed.
<DT><TT><B>-p</B></TT>
<DD>assumes an input loop around your script. Lines are printed.
<DT><TT><B>-P</B></TT>
<DD>runs the C preprocessor on the script before compilation by Perl.
<DT><TT><B>-s</B></TT>
<DD>interprets <TT><B>-xxx</B></TT> on the command line as a switch and sets
the corresponding variable <TT><B>$xxx</B></TT> in the script.
<DT><TT><B>-S</B></TT>
<DD>uses the <TT><B>PATH</B></TT> environment variable to search for the script.
<DT><TT><B>-T</B></TT>
<DD>forces taint checking.
<DT><TT><B>-u</B></TT>
<DD>dumps core after compiling the script. To be used with the <I>undump</I>(1)
program (where available).
<DT><TT><B>-U</B></TT>
<DD>allows perl to perform unsafe operations.
<DT><TT><B>-v</B></TT>
<DD>prints the version and patchlevel of your Perl executable.
<DT><TT><B>-w</B></TT>
<DD>prints warnings about possible spelling errors and other error-prone
constructs in the script.
<DT><TT><B>-x</B></TT> [<FONT SIZE="-1">DIR</FONT>]
<DD>extracts Perl program from input stream.
If <FONT SIZE="-1">DIR</FONT> is specified,
switches to this directory before running the program.
<DT><TT><B>-0</B></TT><FONT SIZE="-1">VAL</FONT>
<DD>(that's the number zero.) Designates an initial value for the record
separator <TT><B>$/</B></TT>. See also <TT><B>-l</B></TT>
</DL>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="literals"></A>
<H2>Literals</H2>
<DL>
<DT>Numeric:
<DD><TT><B>123</B></TT>
<DD><TT><B>1_234</B></TT>
<DD><TT><B>123.4</B></TT>
<DD><TT><B>5E-10</B></TT>
<DD><TT><B>0xff</B></TT> (hex)
<DD><TT><B>0377</B></TT> (octal)
<DT>String:
<DL>
<DT><TT><B>'abc'</B></TT>
<DD>literal string, no variable interpolation or escape characters,
except <TT><B>\'</B></TT> and <TT><B>\\</B></TT>.
Also: <TT><B>q/abc/</B></TT>.
Almost any pair of delimiters can be used instead of <TT><B>/</B></TT>...<TT><B>/</B></TT>.
<DT><TT><B>"abc"</B></TT>
<DD>Variables are interpolated and escape sequences are processed.
Also: <TT><B>qq/abc/</B></TT>.
<BR>Escape sequences:
<TT><B>\t</B></TT> (Tab),
<TT><B>\n</B></TT> (Newline),
<TT><B>\r</B></TT> (Return),
<TT><B>\f</B></TT> (Formfeed),
<TT><B>\b</B></TT> (Backspace),
<TT><B>\a</B></TT> (Alarm),
<TT><B>\e</B></TT> (Escape),
<TT><B>\033</B></TT> (octal),
<TT><B>\x1b</B></TT> (hex),
<TT><B>\c[</B></TT> (control)
<BR><TT><B>\l</B></TT> and <TT><B>\u</B></TT> lowercase/uppercase the following character.
<TT><B>\L</B></TT> and <TT><B>\U</B></TT> lowercase/uppercase until a <TT><B>\E</B></TT>
is encountered.
<TT><B>\Q</B></TT> quote regular expression characters until a <TT><B>\E</B></TT>
is encountered.
<DT><TT><B>`</B></TT><FONT SIZE="-1">COMMAND</FONT><TT><B>`</B></TT>
<DD>evaluates to the output of the <FONT SIZE="-1">COMMAND</FONT>.
Also: <TT><B>qx/</B></TT><FONT SIZE="-1">COMMAND</FONT><TT><B>/</B></TT>.
</DL>
<DT>Array:
<DD><TT><B>(1, 2, 3)</B></TT>. <TT><B>()</B></TT> is an empty array.
<BR><TT><B>(1..4)</B></TT> is the same as <TT><B>(1,2,3,4)</B></TT>,
<BR>likewise <TT><B>('a'..'z')</B></TT>.
<BR><TT><B>qw/foo bar </B></TT>...<TT><B>/</B></TT> is the same as <TT><B>('foo','bar',</B></TT>...<TT><B>)</B></TT>.
<DT>Array reference:
<DD><TT><B>[1,2,3]</B></TT>
<DT>Hash (associative array):
<DD><TT><B>(</B></TT><FONT SIZE="-1">KEY1</FONT><TT><B>,</B></TT>
<FONT SIZE="-1">VAL1</FONT><TT><B>,</B></TT>
<FONT SIZE="-1">KEY2</FONT><TT><B>,</B></TT>
<FONT SIZE="-1">VAL2</FONT><TT><B>,</B></TT>...<TT><B>)</B></TT>
<BR>Also
<TT><B>(</B></TT><FONT SIZE="-1">KEY1</FONT><TT><B>=&gt;</B></TT>
<FONT SIZE="-1">VAL1</FONT><TT><B>,</B></TT>
<FONT SIZE="-1">KEY2</FONT><TT><B>=&gt;</B></TT>
<FONT SIZE="-1">VAL2</FONT><TT><B>,</B></TT>...<TT><B>)</B></TT>
<DT>Hash reference:
<DD><TT><B>{</B></TT><FONT SIZE="-1">KEY1</FONT><TT><B>,</B></TT>
<FONT SIZE="-1">VAL1</FONT><TT><B>,</B></TT>
<FONT SIZE="-1">KEY2</FONT><TT><B>,</B></TT>
<FONT SIZE="-1">VAL2</FONT><TT><B>,</B></TT>...<TT><B>}</B></TT>
<DT>Code reference:
<DD><B>sub</B> <TT><B>{</B></TT><FONT SIZE="-1">STATEMENTS</FONT><TT><B>}</B></TT>
<DT>Filehandles:
<DD>
<TT><B>&lt;STDIN&gt;</B></TT>,
<TT><B>&lt;STDOUT&gt;</B></TT>,
<TT><B>&lt;STDERR&gt;</B></TT>,
<TT><B>&lt;ARGV&gt;</B></TT>,
<TT><B>&lt;DATA&gt;</B></TT>.
<BR>User-specified:
<FONT SIZE="-1">HANDLE</FONT>,
<TT><B>$</B></TT><FONT SIZE="-1">VAR</FONT>.
<DT>Globs:
<DD><TT><B>&lt;</B></TT><FONT SIZE="-1">PATTERN</FONT><TT><B>&gt;</B></TT>
evaluates to all filenames according to the pattern.
Use <TT><B>&lt;${</B></TT><FONT SIZE="-1">VAR</FONT><TT><B>}&gt;</B></TT>
or <B>glob</B>&nbsp;<TT><B>$</B></TT><FONT SIZE="-1">VAR</FONT>
to glob from a variable.
<DT>Here-Is:
<DD><TT><B>&lt;&lt;</B></TT><FONT SIZE="-1">IDENTIFIER</FONT>
<BR>Shell-style "here document."
<DT>Special tokens:
<DD><TT><B>__FILE__</B></TT>: filename;
<TT><B>__LINE__</B></TT>: line number;
<TT><B>__END__</B></TT>: end of program;
remaining lines can be read using the filehandle <TT><B>DATA</B></TT>.
</DL>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="variables"></A>
<H2>Variables</H2>
<TABLE CELLSPACING=0 CELLPADDING=0>
<TR>
<TD VALIGN=top><TT><B>$var</B></TT></TD>
<TD VALIGN=top>a simple scalar variable.</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>$var[28]</B></TT></TD>
<TD VALIGN=top>29th element of array <TT><B>@var</B></TT>.</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>$p = \@var</B></TT></TD>
<TD VALIGN=top>now <TT><B>$p</B></TT> is a reference to array <TT><B>@var</B></TT>.</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>$$p[28]</B></TT></TD>
<TD VALIGN=top>29th element of array referenced by <TT><B>$p</B></TT>.
<BR>Also, <TT><B>$p-&gt;[28]</B></TT>.</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>$var[-1]</B></TT></TD>
<TD VALIGN=top>last element of array <TT><B>@var</B></TT>.</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>$var[$i][$j]</B></TT></TD>
<TD VALIGN=top><TT><B>$j</B></TT>th element of the <TT><B>$i</B></TT>th element of
array <TT><B>@var</B></TT>.</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>$var{'Feb'}</B></TT></TD>
<TD VALIGN=top>one value from hash (associative array) <TT><B>%var</B></TT>.</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>$p = \%var</B></TT></TD>
<TD VALIGN=top>now <TT><B>$p</B></TT> is a reference to hash <TT><B>%var</B></TT>.</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>$$p{'Feb'}</B></TT></TD>
<TD VALIGN=top>a value from hash referenced by <TT><B>$p</B></TT>.
<BR>Also, <TT><B>$p-&gt;{'Feb'}</B></TT>.</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>$#var</B></TT></TD>
<TD VALIGN=top>last index of array <TT><B>@var</B></TT>.</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>@var</B></TT></TD>
<TD VALIGN=top>the entire array;
in a scalar context, the number of elements in the array.</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>@var[3,4,5]</B></TT></TD>
<TD VALIGN=top>a slice of array <TT><B>@var</B></TT>.</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>@var{'a','b'}</B></TT></TD>
<TD VALIGN=top>a slice of <TT><B>%var</B></TT>;
same as <TT><B>($var{'a'},$var{'b'})</B></TT>.</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>%var</B></TT></TD>
<TD VALIGN=top>the entire hash;
in a scalar context, <B>true</B> if the hash has elements.</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>$var{'a',1,</B></TT>...<TT><B>}</B></TT></TD>
<TD VALIGN=top>emulates a multidimensional array.</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>('a'</B></TT>...<TT><B>'z')[4,7,9]</B></TT></TD>
<TD VALIGN=top>a slice of an array literal.</TD>
</TR>
<TR>
<TD VALIGN=top><FONT SIZE="-1">PKG</FONT><TT><B>::</B></TT><FONT SIZE="-1">VAR</FONT></TD>
<TD VALIGN=top>a variable from a package, e.g.,
<TT><B>$pkg::var</B></TT>, <TT><B>@pkg::ary</B></TT>.</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>\</B></TT><FONT SIZE="-1">OBJECT</FONT></TD>
<TD VALIGN=top>reference to an object, e.g.,
<TT><B>\$var</B></TT>, <TT><B>\%hash</B></TT>.</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>*</B></TT><FONT SIZE="-1">NAME</FONT></TD>
<TD VALIGN=top>refers to all objects represented by <FONT SIZE="-1">NAME</FONT>.
<BR><TT><B>*n1 = *n2</B></TT> makes <TT><B>n1</B></TT> an alias for <TT><B>n2</B></TT>.
<BR><TT><B>*n1 = $n2</B></TT> makes <TT><B>$n1</B></TT> an alias for <TT><B>$n2</B></TT>.
</TD>
</TR>
</TABLE>
<P>
You can always use a <TT><B>{</B></TT><FONT SIZE="-1">BLOCK</FONT><TT><B>}</B></TT>
returning the right type of reference instead of the variable identifier, e.g.,
<TT><B>${</B></TT>...<TT><B>}</B></TT>,
<TT><B>&amp;{</B></TT>...<TT><B>}</B></TT>.
<TT><B>$$p</B></TT> is just a shorthand for <TT><B>${$p}</B></TT>.
</P>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<A NAME="operators"></A>
<H2>Operators</H2>
<TABLE CELLSPACING=0 CELLPADDING=0>
<TR>
<TD VALIGN=top><TT><B>**</B></TT></TD>
<TD></TD>
<TD>Exponentiation</TD>
</TR>
<TR>
<TD NOWRAP VALIGN=top><TT><B>+ -&nbsp;</B></TT></TD>
<TD NOWRAP VALIGN=top><TT><B>* /&nbsp;</B></TT></TD>
<TD>Addition, subtraction, multiplication, division</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>%</B></TT></TD>
<TD></TD>
<TD>Modulo division</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>&amp; |</B></TT></TD>
<TD VALIGN=top><TT><B>^</B></TT></TD>
<TD>Bitwise AND, bitwise OR, bitwise exclusive OR</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>&gt;&gt;</B></TT></TD>
<TD VALIGN=top><TT><B>&lt;&lt;</B></TT></TD>
<TD>Bitwise shift right, bitwise shift left</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>||</B></TT></TD>
<TD VALIGN=top><TT><B>&amp;&amp;</B></TT></TD>
<TD>Logical OR, logical AND</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>.</B></TT></TD>
<TD></TD>
<TD>Concatenation of two strings</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>x</B></TT></TD>
<TD VALIGN=top></TD>
<TD VALIGN=top>Returns a string or array consisting of the left operand (an array or a string)
repeated the number of times specified by the right operand</TD>
</TR>
<TR>
<TD COLSPAN=3>
All of the above operators also have an assignment operator,
e.g., <TT><B>.=</B></TT></TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>-&gt;</B></TT></TD>
<TD></TD>
<TD>Dereference operator</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>\</B></TT></TD>
<TD></TD>
<TD>Reference (unary)</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>!</B></TT></TD>
<TD VALIGN=top><TT><B>~</B></TT></TD>
<TD>Negation (unary), bitwise complement (unary)</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>++</B></TT></TD>
<TD VALIGN=top><TT><B>--</B></TT></TD>
<TD>Auto-increment (magical on strings), auto-decrement</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>==</B></TT></TD>
<TD VALIGN=top><TT><B>!=</B></TT></TD>
<TD>Numeric equality, inequality</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>eq</B></TT></TD>
<TD VALIGN=top><TT><B>ne</B></TT></TD>
<TD>String equality, inequality</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>&lt;</B></TT></TD>
<TD VALIGN=top><TT><B>&gt;</B></TT></TD>
<TD>Numeric less than, greater than</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>lt</B></TT></TD>
<TD VALIGN=top><TT><B>gt</B></TT></TD>
<TD>String less than, greater than</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>&lt;=</B></TT></TD>
<TD VALIGN=top><TT><B>&gt;=</B></TT></TD>
<TD>Numeric less (greater) than or equal to</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>le</B></TT></TD>
<TD VALIGN=top><TT><B>ge</B></TT></TD>
<TD>String less (greater) than or equal to</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>&lt;=&gt;</B></TT></TD>
<TD VALIGN=top><TT><B>cmp</B></TT></TD>
<TD>Numeric (string) compare. Returns -1, 0, 1.</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>=~</B></TT></TD>
<TD VALIGN=top><TT><B>!~</B></TT></TD>
<TD>Search pattern, substitution, or translation (negated)</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>..</B></TT></TD>
<TD></TD>
<TD>Range (scalar context) or enumeration (array context)</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>?:</B></TT></TD>
<TD></TD>
<TD>Alternation (if-then-else) operator</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>,</B></TT></TD>
<TD></TD>
<TD>Comma operator, also list element separator.
You can also use <TT><B>=&gt;</B></TT>.
</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>not</B></TT></TD>
<TD></TD>
<TD>Low-precedence negation
</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>and</B></TT></TD>
<TD></TD>
<TD>Low-precedence AND
</TD>
</TR>
<TR>
<TD VALIGN=top><TT><B>or</B></TT></TD>
<TD VALIGN=top><TT><B>xor</B></TT></TD>
<TD>Low-precedence OR, exclusive OR
</TD>
</TR>
</TABLE>
<P>All Perl functions can be used as list operators, in which case
they have very high or very low precedence, depending on
whether you look at the left or the right side of the operator.
Only the operators <B>not</B>, <B>and</B>, <B>or</B> and <B>xor</B> have lower precedence.</P>
<P>A "list" is a list of expressions, variables, or lists. An array
variable or an array slice may always be used instead of a list.</P>
<P>Parentheses can be added around the parameter lists
to avoid precedence problems.</P>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="statements"></A>
<H2>Statements</H2>
<P>Every statement is an expression, optionally followed by a modifier,
and terminated by a semicolon. The semicolon may be omitted if the
statement is the final one in a <FONT SIZE="-1">BLOCK</FONT>.</P>
<P>Execution of expressions can depend on other expressions using one of the modifiers
<B>if</B>, <B>unless</B>, <B>while</B> or <B>until</B>, for example:</P>
<UL>
<FONT SIZE="-1">EXPR1</FONT> <B>if</B> <FONT SIZE="-1">EXPR2</FONT> <TT><B>;</B></TT>
<BR>
<FONT SIZE="-1">EXPR1</FONT> <B>until</B> <FONT SIZE="-1">EXPR2</FONT> <TT><B>;</B></TT>
</UL>
<P>The logical operators <TT><B>||</B></TT>,
<TT><B>&amp;&amp;</B></TT> or
<TT><B>?:</B></TT> also allow conditional execution:</P>
<UL>
<FONT SIZE="-1">EXPR1</FONT> <TT><B>||</B></TT> <FONT SIZE="-1">EXPR2</FONT> <TT><B>;</B></TT>
<BR>
<FONT SIZE="-1">EXPR1</FONT> <TT><B>?</B></TT> <FONT SIZE="-1">EXPR2</FONT> <TT><B>:</B></TT> <FONT SIZE="-1">EXPR3</FONT> <TT><B>;</B></TT>
</UL>
<P>Statements can be combined to form a <FONT SIZE="-1">BLOCK</FONT>
when enclosed in <TT><B>{}</B></TT>. Blocks may be used to control flow:</P>
<UL>
<B>if</B> <TT><B>(</B></TT><FONT SIZE="-1">EXPR</FONT><TT><B>)</B></TT> <FONT SIZE="-1">BLOCK</FONT>
[ [ <B>elsif</B> <TT><B>(</B></TT><FONT SIZE="-1">EXPR</FONT><TT><B>)</B></TT> <FONT SIZE="-1">BLOCK</FONT> ... ]
<B>else</B> <FONT SIZE="-1">BLOCK</FONT> ]
<BR>
<B>unless</B> <TT><B>(</B></TT><FONT SIZE="-1">EXPR</FONT><TT><B>)</B></TT> <FONT SIZE="-1">BLOCK</FONT>
[ <B>else</B> <FONT SIZE="-1">BLOCK</FONT> ]
<BR>
[ <FONT SIZE="-1">LABEL</FONT><TT><B>:</B></TT> ]
<B>while</B> (<FONT SIZE="-1">EXPR</FONT>) <FONT SIZE="-1">BLOCK</FONT> [ <B>continue</B> <FONT SIZE="-1">BLOCK</FONT> ]
<BR>
[ <FONT SIZE="-1">LABEL</FONT><TT><B>:</B></TT> ]
<B>until</B> (<FONT SIZE="-1">EXPR</FONT>) <FONT SIZE="-1">BLOCK</FONT> [ <B>continue</B> <FONT SIZE="-1">BLOCK</FONT> ]
<BR>
[ <FONT SIZE="-1">LABEL</FONT><TT><B>:</B></TT> ]
<B>for</B> (<FONT SIZE="-1">EXPR</FONT><TT><B>;</B></TT> <FONT SIZE="-1">EXPR</FONT><TT><B>;</B></TT> <FONT SIZE="-1">EXPR</FONT>) <FONT SIZE="-1">BLOCK</FONT>
<BR>
[ <FONT SIZE="-1">LABEL</FONT><TT><B>:</B></TT> ]
<B>foreach</B> <FONT SIZE="-1">VAR&#134;</FONT> (<FONT SIZE="-1">LIST</FONT>) <FONT SIZE="-1">BLOCK</FONT>
<BR>
[ <FONT SIZE="-1">LABEL</FONT><TT><B>:</B></TT> ]
<FONT SIZE="-1">BLOCK</FONT> [ <B>continue</B> <FONT SIZE="-1">BLOCK</FONT> ]
</UL>
<P>Program flow can be controlled with:</P>
<UL>
<TABLE CELLPADDING=0 CELLSPACING=0>
<TR><TD NOWRAP VALIGN=top><B>goto</B> <FONT SIZE="-1">LABEL</FONT></TD>
<TD>Continue execution at the specified label.</TD></TR>
<TR><TD NOWRAP VALIGN=top><B>last</B> [ <FONT SIZE="-1">LABEL</FONT> ]</TD>
<TD>Immediately exits the loop in question. Skips continue block.</TD></TR>
<TR><TD NOWRAP VALIGN=top><B>next</B> [ <FONT SIZE="-1">LABEL</FONT> ]</TD>
<TD>Starts the next iteration of the loop.</TD></TR>
<TR><TD NOWRAP VALIGN=top><B>redo</B> [ <FONT SIZE="-1">LABEL</FONT> ]&nbsp;&nbsp;</TD>
<TD>Restarts the loop block without evaluating the conditional again.</TD></TR>
</TABLE>
</UL>
<P>Special forms are:</P>
<UL>
<B>do</B> <FONT SIZE="-1">BLOCK</FONT> <B>while</B> <FONT SIZE="-1">EXPR</FONT> <TT><B>;</B></TT>
<BR>
<B>do</B> <FONT SIZE="-1">BLOCK</FONT> <B>until</B> <FONT SIZE="-1">EXPR</FONT> <TT><B>;</B></TT>
</UL>
<P>which are guaranteed to perform <FONT SIZE="-1">BLOCK</FONT>
once before testing <FONT SIZE="-1">EXPR</FONT>, and</P>
<UL>
<B>do</B> <FONT SIZE="-1">BLOCK</FONT>
</UL>
<P>which effectively turns <FONT SIZE="-1">BLOCK</FONT> into an expression.</P>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="subroutines"></A>
<H2>Subroutines, Packages and Modules</H2>
<DL>
<DT><TT><B>&amp;</B></TT><FONT SIZE="-1">SUBROUTINE LIST</FONT>
<DD>Executes a <FONT SIZE="-1">SUBROUTINE</FONT> declared by a <B>sub</B> declaration, and
returns the value of the last expression evaluated in <FONT SIZE="-1">SUBROUTINE</FONT>.
<FONT SIZE="-1">SUBROUTINE</FONT> can be an expression yielding a reference to a code object.
The <TT><B>&amp;</B></TT> may be omitted if the subroutine has been declared
before being used.
<DT><B>bless</B> <FONT SIZE="-1">REF</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">PACKAGE</FONT> ]
<DD>Turns the object <FONT SIZE="-1">REF</FONT>
into an object in <FONT SIZE="-1">PACKAGE</FONT>.
Returns the reference.
<DT><B>caller</B> [ <FONT SIZE="-1">EXPR</FONT> ]
<DD>Returns an array (<TT><B>$</B></TT>package,<TT><B>$</B></TT>file,<TT><B>$</B></TT>line,...)
for a specific subroutine call.
<TT><B>caller</B></TT> returns this info for the current subroutine,
<TT><B>caller(1)</B></TT> for the caller of this subroutine, etc.
Returns <B>false</B> if no caller.
<DT><B>do</B> <FONT SIZE="-1">SUBROUTINE</FONT> <FONT SIZE="-1">LIST</FONT>
<DD>Depreciated form of <TT><B>&amp;</B></TT><FONT SIZE="-1">SUBROUTINE</FONT>.
<DT><B>goto</B> <TT><B>&amp;</B></TT><FONT SIZE="-1">SUBROUTINE</FONT>
<DD>Substitutes a call to <FONT SIZE="-1">SUBROUTINE</FONT> for the current subroutine.
<DT><B>import</B> <FONT SIZE="-1">MODULE</FONT> [ [ <FONT SIZE="-1">VERSION</FONT> ] <FONT SIZE="-1">LIST</FONT> ]
<DD>Imports the named subroutines from <FONT SIZE="-1">MODULE</FONT>.
<DT><B>no</B> <FONT SIZE="-1">MODULE</FONT> [ <FONT SIZE="-1">LIST</FONT> ]
<DD>Cancels imported semantics. See <B>use</B>.
<DT><B>package</B> <FONT SIZE="-1">NAME</FONT>
<DD>Designates the remainder of the current block as a package.
<DT><B>require</B> <FONT SIZE="-1">EXPR&#134;</FONT>
<DD>If <FONT SIZE="-1">EXPR</FONT> is numeric, requires Perl to be at least that
version. Otherwise <FONT SIZE="-1">EXPR</FONT> must be the name of a file
that is included from the Perl library. Does not
include more than once, and yields a fatal error if
the file does not evaluate to a <B>true</B> value.
If <FONT SIZE="-1">EXPR</FONT> is a bare word, assumes extension <TT><B>.pm</B></TT>
for the name of the file.
<DT><B>return</B> <FONT SIZE="-1">EXPR</FONT>
<DD>Returns from a subroutine with the value specified.
<DT><B>sub</B> <FONT SIZE="-1">NAME</FONT> <TT><B>{</B></TT> <FONT SIZE="-1">EXPR</FONT> <TT><B>;</B></TT> ... <TT><B>}</B></TT>
<DD>Designates <FONT SIZE="-1">NAME</FONT> as a subroutine.
Parameters are passed by reference as array <TT><B>@_</B></TT>.
Returns the value of the last expression evaluated.
<DT>[ <B>sub</B> ] <TT><B>BEGIN</B></TT> <TT><B>{</B></TT> <FONT SIZE="-1">EXPR</FONT> <TT><B>;</B></TT> ... <TT><B>}</B></TT>
<DD>Defines a setup <FONT SIZE="-1">BLOCK</FONT> to be called before execution.
<DT>[ <B>sub</B> ] <TT><B>END</B></TT> <TT><B>{</B></TT> <FONT SIZE="-1">EXPR</FONT> <TT><B>;</B></TT> ... <TT><B>}</B></TT>
<DD>Defines a cleanup <FONT SIZE="-1">BLOCK</FONT> to be called upon termination.
<DT><B>tie</B> <FONT SIZE="-1">VAR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">PACKAGE</FONT><TT><B>,</B></TT> [ <FONT SIZE="-1">LIST</FONT> ]
<DD>Ties a variable to a package that will handle it.
Can be used to bind a dbm or ndbm file to a hash.
<DT><B>untie</B> <FONT SIZE="-1">VAR</FONT>
<DD>Breaks the binding between the variable and the package.
<DT><B>use</B> <FONT SIZE="-1">MODULE</FONT> [ [ <FONT SIZE="-1">VERSION</FONT> ] <FONT SIZE="-1">LIST</FONT> ]
<DD>Imports semantics from the named module into the current package.
</DL>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="object"></A>
<H2>Object-Oriented Programming</H2>
<P>Perl rules of object oriented programming:</P>
<UL>
<LI>An object is simply a reference that happens to know which class it
belongs to. Objects are blessed, references are not.
<LI>A class is simply a package that happens to provide methods to deal
with object references. If a package fails to provide a method, the base classes as
listed in <TT><B>@ISA</B></TT> are searched.
<LI>A method is simply a subroutine that expects an object reference (or a
package name, for static methods) as the first argument.
</UL>
<P>Methods can be applied with:</P>
<UL>
<FONT SIZE="-1">METHOD</FONT> <FONT SIZE="-1">OBJREF</FONT> <FONT SIZE="-1">PARAMETERS</FONT>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or<BR>
<FONT SIZE="-1">OBJREF</FONT><TT><B>-&gt;</B></TT><FONT SIZE="-1">METHOD</FONT> <FONT SIZE="-1">PARAMETERS</FONT>
</UL>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="arithmetic"></A>
<H2>Arithmetic Functions</H2>
<TABLE CELLSPACING=0 CELLPADDING=0>
<TR><TD VALIGN=top><B>abs</B> <FONT SIZE="-1">EXPR&#134;</FONT></TD>
<TD VALIGN=top>Returns the absolute value of its operand.</TD></TR>
<TR><TD VALIGN=top><B>atan2</B> <FONT SIZE="-1">Y</FONT><TT><B>,</B></TT><FONT SIZE="-1">X</FONT></TD>
<TD VALIGN=top>Returns the arctangent of <FONT SIZE="-1">Y/X</FONT> in the range -pi to pi.</TD></TR>
<TR><TD VALIGN=top><B>cos</B> <FONT SIZE="-1">EXPR&#134;</FONT></TD>
<TD VALIGN=top>Returns the cosine of <FONT SIZE="-1">EXPR</FONT> (expressed in radians).</TD></TR>
<TR><TD VALIGN=top><B>exp</B> <FONT SIZE="-1">EXPR&#134;</FONT></TD>
<TD VALIGN=top>Returns <TT><B>e</B></TT> to the power of <FONT SIZE="-1">EXPR</FONT>.</TD></TR>
<TR><TD VALIGN=top><B>int</B> <FONT SIZE="-1">EXPR&#134;</FONT></TD>
<TD VALIGN=top>Returns the integer portion of <FONT SIZE="-1">EXPR</FONT>.</TD></TR>
<TR><TD VALIGN=top><B>log</B> <FONT SIZE="-1">EXPR&#134;</FONT></TD>
<TD VALIGN=top>Returns natural logarithm (base <TT><B>e</B></TT>) of <FONT SIZE="-1">EXPR</FONT>.</TD></TR>
<TR><TD VALIGN=top><B>rand</B> [ <FONT SIZE="-1">EXPR</FONT> ]</TD>
<TD VALIGN=top>Returns a random fractional number between 0 and the value of <FONT SIZE="-1">EXPR</FONT>.
If <FONT SIZE="-1">EXPR</FONT> is omitted, returns a value between 0 and 1.</TD></TR>
<TR><TD VALIGN=top><B>sin</B> <FONT SIZE="-1">EXPR&#134;</FONT></TD>
<TD VALIGN=top>Returns the sine of <FONT SIZE="-1">EXPR</FONT> (expressed in radians).</TD></TR>
<TR><TD VALIGN=top><B>sqrt</B> <FONT SIZE="-1">EXPR&#134;</FONT></TD>
<TD VALIGN=top>Returns the square root of <FONT SIZE="-1">EXPR</FONT>.</TD></TR>
<TR><TD VALIGN=top NOWRAP><B>srand</B> [ <FONT SIZE="-1">EXPR</FONT> ] &nbsp;&nbsp;</TD>
<TD VALIGN=top>Sets the random number seed for the <B>rand</B> operator.</TD></TR>
<TR><TD VALIGN=top><B>time</B></TD>
<TD VALIGN=top>Returns the number of seconds since January 1, 1970. Suitable for
feeding to <B>gmtime</B> and <B>localtime</B>.</TD></TR>
</TABLE>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="conversion"></A>
<H2>Conversion Functions</H2>
<DL>
<DT><B>chr</B> <FONT SIZE="-1">EXPR&#134;</FONT>
<DD>Returns the character represented by the decimal value <FONT SIZE="-1">EXPR</FONT>.
<DT><B>gmtime</B> <FONT SIZE="-1">EXPR&#134;</FONT>
<DD>Converts a time as returned by the <B>time</B> function to a 9-element array
(0:&nbsp;<TT><B>$</B></TT>sec,
1:&nbsp;<TT><B>$</B></TT>min,
2:&nbsp;<TT><B>$</B></TT>hour,
3:&nbsp;<TT><B>$</B></TT>mday,
4:&nbsp;<TT><B>$</B></TT>mon,
5:&nbsp;<TT><B>$</B></TT>year,
6:&nbsp;<TT><B>$</B></TT>wday,
7:&nbsp;<TT><B>$</B></TT>yday,
8:&nbsp;<TT><B>$</B></TT>isdst)
with the time analyzed for the Greenwich time zone. <TT><B>$</B></TT>mon has the range 0..11 and
<TT><B>$</B></TT>wday has the range 0..6.
<DT><B>hex</B> <FONT SIZE="-1">EXPR&#134;</FONT>
<DD>Returns the decimal value of <FONT SIZE="-1">EXPR</FONT> interpreted as a hex string.
<DT><B>localtime</B> <FONT SIZE="-1">EXPR&#134;</FONT>
<DD>Converts a time as returned by the <B>time</B> function to
<I>ctime</I>(3) string.
In array context, returns a 9-element array with the time analyzed for the local time zone.
<DT><B>oct</B> <FONT SIZE="-1">EXPR&#134;</FONT>
<DD>Returns the decimal value of <FONT SIZE="-1">EXPR</FONT> interpreted as an octal string.
If <FONT SIZE="-1">EXPR</FONT> starts off with <TT><B>0x</B></TT>, interprets it as a hex string
instead.
<DT><B>ord</B> <FONT SIZE="-1">EXPR&#134;</FONT>
<DD>Returns the ASCII value of the first character of <FONT SIZE="-1">EXPR</FONT>.
<DT><B>vec</B> <FONT SIZE="-1">EXPR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">OFFSET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">BITS</FONT>
<DD>Treats string <FONT SIZE="-1">EXPR</FONT> as a vector of unsigned integers,
and yields the bit at <FONT SIZE="-1">OFFSET</FONT>.
<FONT SIZE="-1">BITS</FONT> must be between 1 and 32.
May be assigned to.
</DL>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="structure"></A>
<H2>Structure Conversion</H2>
<DL>
<DT><B>pack</B> <FONT SIZE="-1">TEMPLATE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LIST</FONT>
<DD>Packs the values into a binary structure using <FONT SIZE="-1">TEMPLATE</FONT>.
<DT><B>unpack</B> <FONT SIZE="-1">TEMPLATE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">EXPR</FONT>
<DD>Unpacks the structure <FONT SIZE="-1">EXPR</FONT> into an array,
using <FONT SIZE="-1">TEMPLATE</FONT>.
</DL>
<P><FONT SIZE="-1">TEMPLATE</FONT> is a sequence of characters as follows:</P>
<UL>
<TABLE CELLSPACING=0 CELLPADDING=0>
<TR><TD><TT><B>a</B></TT> / <TT><B>A&nbsp;</B></TT></TD>
<TD>ASCII string, null- / space-padded</TD></TR>
<TR><TD><TT><B>b</B></TT> / <TT><B>B</B></TT></TD>
<TD>Bit string in ascending / descending order</TD></TR>
<TR><TD><TT><B>c</B></TT> / <TT><B>C</B></TT></TD>
<TD>Native / unsigned char value</TD></TR>
<TR><TD><TT><B>f</B></TT> / <TT><B>d</B></TT></TD>
<TD>Single / double float in native format</TD></TR>
<TR><TD><TT><B>h</B></TT> / <TT><B>H</B></TT></TD>
<TD>Hex string, low / high nybble first</TD></TR>
<TR><TD><TT><B>i</B></TT> / <TT><B>I</B></TT></TD>
<TD>Signed / unsigned integer value</TD></TR>
<TR><TD><TT><B>l</B></TT> / <TT><B>L</B></TT></TD>
<TD>Signed / unsigned long value</TD></TR>
<TR><TD><TT><B>n</B></TT> / <TT><B>N</B></TT></TD>
<TD>Short / long in network (big endian) byte order</TD></TR>
<TR><TD><TT><B>s</B></TT> / <TT><B>S</B></TT></TD>
<TD>Signed / unsigned short value</TD></TR>
<TR><TD><TT><B>u</B></TT> / <TT><B>P</B></TT></TD>
<TD>Uuencoded string / pointer to a string</TD></TR>
<TR><TD><TT><B>v</B></TT> / <TT><B>V</B></TT></TD>
<TD>Short / long in VAX (little endian) byte order</TD></TR>
<TR><TD><TT><B>x</B></TT> / <TT><B>@</B></TT></TD>
<TD>Null byte / null fill until position</TD></TR>
<TR><TD><TT><B>X</B></TT></TD>
<TD>Backup a byte</TD></TR>
</TABLE>
</UL>
<P>Each character may be followed by a decimal number that
will be used as a repeat count; an asterisk (<TT><B>*</B></TT>) specifies all
remaining arguments. If the format is preceded with <TT><B>%</B></TT><FONT SIZE="-1">N</FONT>,
<B>unpack</B> returns an <FONT SIZE="-1">N</FONT>-bit checksum instead. Spaces may be
included in the template for readability purposes.</P>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="string"></A>
<H2>String Functions</H2>
<DL>
<DT><B>chomp</B> <FONT SIZE="-1">LIST&#134;</FONT>
<DD>Removes line endings from all elements of the list;
returns the (total) number of characters removed.
<DT><B>chop</B> <FONT SIZE="-1">LIST&#134;</FONT>
<DD>Chops off the last character on all elements of the
list; returns the last chopped character.
<DT><B>crypt</B> <FONT SIZE="-1">PLAINTEXT</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SALT</FONT>
<DD>Encrypts a string.
<DT><B>eval</B> <FONT SIZE="-1">EXPR&#134;</FONT>
<DD><FONT SIZE="-1">EXPR</FONT> is parsed and executed as if it were a Perl program.
The value returned is the value of the last expression evaluated.
If there is a syntax error or runtime error,
an undefined string is returned by <B>eval</B>, and
<TT><B>$@</B></TT> is set to the error message.
See also <B>eval</B> in section <A HREF="#miscellaneous">Miscellaneous</A>.
<DT><B>index</B> <FONT SIZE="-1">STR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SUBSTR</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">OFFSET</FONT> ]
<DD>Returns the position of <FONT SIZE="-1">SUBSTR</FONT>
in <FONT SIZE="-1">STR</FONT> at or after <FONT SIZE="-1">OFFSET</FONT>.
If the substring is not found, returns <TT><B>-1</B></TT>
(but see <TT><B>$[</B></TT> in section <A HREF="#specialvariables">Special Variables</A>).
<DT><B>length</B> <FONT SIZE="-1">EXPR&#134;</FONT>
<DD>Returns the length in characters of the value of <FONT SIZE="-1">EXPR</FONT>.
<DT><B>lc</B> <FONT SIZE="-1">EXPR</FONT>
<DD>Returns a lowercase version of <FONT SIZE="-1">EXPR</FONT>.
<DT><B>lcfirst</B> <FONT SIZE="-1">EXPR</FONT>
<DD>Returns <FONT SIZE="-1">EXPR</FONT> with the first character lowercase.
<DT><B>quotemeta</B> <FONT SIZE="-1">EXPR</FONT>
<DD>Returns <FONT SIZE="-1">EXPR</FONT> with all regular expression metacharacters quoted.
<DT><B>rindex</B> <FONT SIZE="-1">STR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SUBSTR</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">OFFSET</FONT> ]
<DD>Returns the position of the last <FONT SIZE="-1">SUBSTR</FONT>
in <FONT SIZE="-1">STR</FONT> at or before <FONT SIZE="-1">OFFSET</FONT>.
<DT><B>substr</B> <FONT SIZE="-1">EXPR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">OFFSET</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">LEN</FONT> ]
<DD>Extracts a substring of length <FONT SIZE="-1">LEN</FONT> out of <FONT SIZE="-1">EXPR</FONT>
and returns it. If <FONT SIZE="-1">OFFSET</FONT> is negative, counts from the end of
the string. May be assigned to.
<DT><B>uc</B> <FONT SIZE="-1">EXPR</FONT>
<DD>Returns an uppercased version of <FONT SIZE="-1">EXPR</FONT>.
<DT><B>ucfirst</B> <FONT SIZE="-1">EXPR</FONT>
<DD>Returns <FONT SIZE="-1">EXPR</FONT> with the first character uppercased.
</DL>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="array"></A>
<H2>Array and List Functions</H2>
<DL>
<DT><B>delete</B> <TT><B>$</B></TT><FONT SIZE="-1">HASH</FONT><TT><B>{</B></TT><FONT SIZE="-1">KEY</FONT><TT><B>}</B></TT>
<DD>Deletes the specified value from the specified hash.
Returns the deleted value unless <FONT SIZE="-1">HASH</FONT> is <B>tie</B>d
to a package that does not support this.
<DT><B>each</B> <TT><B>%</B></TT><FONT SIZE="-1">HASH</FONT>
<DD>Returns a 2-element array consisting of the key and value for the next value
of the hash. Entries are returned in an apparently random order.
After all values of the hash have been returned, a null array is
returned. The next call to <B>each</B> after that will start iterating again.
<DT><B>exists</B> <FONT SIZE="-1">EXPR&#134;</FONT>
<DD>Checks if the specified hash key exists in its hash array.
<DT><B>grep</B> <FONT SIZE="-1">EXPR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LIST</FONT>
<BR><B>grep</B> <FONT SIZE="-1">BLOCK</FONT> <FONT SIZE="-1">LIST</FONT>
<DD>Evaluates <FONT SIZE="-1">EXPR</FONT> or <FONT SIZE="-1">BLOCK</FONT> for each element of the <FONT SIZE="-1">LIST</FONT>,
locally setting <TT><B>$_</B></TT> to refer to the element.
Modifying <TT><B>$_</B></TT> will modify the
corresponding element from <FONT SIZE="-1">LIST</FONT>.
Returns the array of elements from
<FONT SIZE="-1">LIST</FONT> for which <FONT SIZE="-1">EXPR</FONT> returned <B>true</B>.
<DT><B>join</B> <FONT SIZE="-1">EXPR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LIST</FONT>
<DD>Joins the separate strings of <FONT SIZE="-1">LIST</FONT> into a single string with fields
separated by the value of <FONT SIZE="-1">EXPR</FONT>, and returns the string.
<DT><B>keys</B> <TT><B>%</B></TT><FONT SIZE="-1">HASH</FONT>
<DD>Returns an array with of all the keys of the named hash.
<DT><B>map</B> <FONT SIZE="-1">EXPR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LIST</FONT>
<BR><B>map</B> <FONT SIZE="-1">BLOCK</FONT> <FONT SIZE="-1">LIST</FONT>
<DD>Evaluates <FONT SIZE="-1">EXPR</FONT> or <FONT SIZE="-1">BLOCK</FONT> for each element of the <FONT SIZE="-1">LIST</FONT>,
locally setting <TT><B>$_</B></TT> to refer to the element.
Modifying <TT><B>$_</B></TT> will modify the
corresponding element from <FONT SIZE="-1">LIST</FONT>.
Returns the list of results.
<DT><B>pop</B> <TT><B>@</B></TT><FONT SIZE="-1">ARRAY</FONT>
<DD>Pops off and returns the last value of the array.
<DT><B>push</B> <TT><B>@</B></TT><FONT SIZE="-1">ARRAY</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LIST</FONT>
<DD>Pushes the values of <FONT SIZE="-1">LIST</FONT> onto the end of the array.
<DT><B>reverse</B> <FONT SIZE="-1">LIST</FONT>
<DD>In array context, returns the <FONT SIZE="-1">LIST</FONT> in reverse order.
In scalar context: returns the first element of <FONT SIZE="-1">LIST</FONT>
with bytes reversed.
<DT><B>scalar</B> <TT><B>@</B></TT><FONT SIZE="-1">ARRAY</FONT>
<DD>Returns the number of elements in the array.
<DT><B>scalar</B> <TT><B>%</B></TT><FONT SIZE="-1">HASH</FONT>
<DD>Returns a <B>true</B> value if the hash has elements defined.
<DT><B>shift</B> [ <TT><B>@</B></TT><FONT SIZE="-1">ARRAY</FONT> ]
<DD>Shifts the first value of the array off and returns it, shortening the array
by 1 and moving everything down. If <TT><B>@</B></TT><FONT SIZE="-1">ARRAY</FONT> is omitted,
shifts <TT><B>@ARGV</B></TT> in main and <TT><B>@_</B></TT> in subroutines.
<DT><B>sort</B> [ <FONT SIZE="-1">SUBROUTINE</FONT> ] <FONT SIZE="-1">LIST</FONT>
<DD>Sorts the <FONT SIZE="-1">LIST</FONT> and returns the sorted array value.
<FONT SIZE="-1">SUBROUTINE</FONT>, if specified, must return less than zero,
zero, or greater than zero, depending on how the
elements of the array (available to the routine as <TT><B>$a</B></TT> and <TT><B>$b</B></TT>)
are to be ordered. <FONT SIZE="-1">SUBROUTINE</FONT> may be the name of a user-defined
routine, or a <FONT SIZE="-1">BLOCK</FONT>.
<DT><B>splice</B> <TT><B>@</B></TT><FONT SIZE="-1">ARRAY</FONT><TT><B>,</B></TT> <FONT SIZE="-1">OFFSET</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">LENGTH</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">LIST</FONT> ] ]
<DD>Removes the elements of <TT><B>@</B></TT><FONT SIZE="-1">ARRAY</FONT> designated by
<FONT SIZE="-1">OFFSET</FONT> and <FONT SIZE="-1">LENGTH</FONT>,
and replaces them with <FONT SIZE="-1">LIST</FONT> (if specified).
Returns the elements removed.
<DT><B>split</B> [ <FONT SIZE="-1">PATTERN</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">EXPR&#134;</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">LIMIT</FONT> ] ] ]
<DD>Splits a string into an array of strings, and returns it.
If <FONT SIZE="-1">LIMIT</FONT> is specified, splits into at most that number
of fields. If <FONT SIZE="-1">PATTERN</FONT> is also omitted, splits at the whitespace.
If not in array context, returns number of fields and splits to <TT><B>@_</B></TT>.
See also <A HREF="#search">Search and Replace Functions</A>.
<DT><B>unshift</B> <TT><B>@</B></TT><FONT SIZE="-1">ARRAY</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LIST</FONT>
<DD>Prepends list to the front of the array, and returns the number of elements in
the new array.
<DT><B>values</B> <TT><B>%</B></TT><FONT SIZE="-1">HASH</FONT>
<DD>Returns a normal array consisting of all the values of the named hash.
</DL>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="regular"></A>
<H2>Regular Expressions</H2>
<P>Each character matches itself, unless it is one of the special characters
<TT><B>+ ? . * ^ $ ( ) [ ] { } | \</B></TT>.
The special meaning of these characters can be escaped using a <TT><B>\</B></TT>.</P>
<TABLE CELLSPACING=0 CELLPADDING=0>
<TR><TD VALIGN=top><TT><B>.</B></TT></TD>
<TD VALIGN=top>matches an arbitrary character, but not a newline
unless it is a single-line match (see <B>m//s</B>).</TD></TR>
<TR><TD VALIGN=top><TT><B>(</B></TT>...<TT><B>)</B></TT></TD>
<TD>groups a series of pattern elements to a single element.</TD></TR>
<TR><TD VALIGN=top><TT><B>^</B></TT></TD>
<TD VALIGN=top>matches the beginning of the target. In multiline mode
(see <B>m//m</B>) also matches after every newline character.</TD></TR>
<TR><TD VALIGN=top><TT><B>$</B></TT></TD>
<TD>matches the end of the line.
In multiline mode also matches before every newline character.</TD></TR>
<TR><TD VALIGN=top><TT><B>[</B></TT> ... <TT><B>]</B></TT></TD>
<TD>denotes a class of characters to match.
<TT><B>[^</B></TT> ... <TT><B>]</B></TT> negates the class.</TD></TR>
<TR><TD VALIGN=top><TT><B>(</B></TT> ... <TT><B>|</B></TT> ... <TT><B>|</B></TT> ... <TT><B>)</B></TT></TD>
<TD>matches one of the alternatives.</TD></TR>
<TR><TD VALIGN=top><TT><B>(?#</B></TT> <FONT SIZE="-1">TEXT</FONT> <TT><B>)</B></TT></TD>
<TD>Comment.</TD></TR>
<TR><TD VALIGN=top><TT><B>(?:</B></TT> <FONT SIZE="-1">REGEXP</FONT> <TT><B>)</B></TT></TD>
<TD>Like <TT><B>(</B></TT><FONT SIZE="-1">REGEXP</FONT><TT><B>)</B></TT> but does not make back-references.</TD></TR>
<TR><TD VALIGN=top><TT><B>(?=</B></TT> <FONT SIZE="-1">REGEXP</FONT> <TT><B>)</B></TT></TD>
<TD>Zero width positive look-ahead assertion.</TD></TR>
<TR><TD VALIGN=top><TT><B>(?!</B></TT> <FONT SIZE="-1">REGEXP</FONT> <TT><B>)</B></TT></TD>
<TD>Zero width negative look-ahead assertion.</TD></TR>
<TR><TD VALIGN=top><TT><B>(?</B></TT> <FONT SIZE="-1">MODIFIER</FONT> <TT><B>)</B></TT></TD>
<TD>Embedded pattern-match modifier. <FONT SIZE="-1">MODIFIER</FONT> can be one or more of
<B>i</B>, <B>m</B>, <B>s</B>, or <B>x</B>.</TD></TR>
<TR><TD COLSPAN=2><BR>Quantified subpatterns match as many times as possible.
When followed with a <TT><B>?</B></TT> they match the minimum number of times.
These are the quantifiers:<BR><BR></TD></TR>
<TR><TD VALIGN=top><TT><B>+</B></TT></TD>
<TD>matches the preceding pattern element one or more times.</TD></TR>
<TR><TD VALIGN=top><TT><B>?</B></TT></TD>
<TD>matches zero or one times.</TD></TR>
<TR><TD VALIGN=top><TT><B>*</B></TT></TD>
<TD>matches zero or more times.</TD></TR>
<TR><TD VALIGN=top><TT><B>{</B></TT><FONT SIZE="-1">N</FONT><TT><B>,</B></TT><FONT SIZE="-1">M</FONT><TT><B>}</B></TT></TD>
<TD>denotes the minimum <FONT SIZE="-1">N</FONT> and maximum <FONT SIZE="-1">M</FONT> match count.
<TT><B>{</B></TT><FONT SIZE="-1">N</FONT><TT><B>}</B></TT> means exactly <FONT SIZE="-1">N</FONT> times;
<TT><B>{</B></TT><FONT SIZE="-1">N</FONT><TT><B>,</B></TT><TT><B>}</B></TT> means at least <FONT SIZE="-1">N</FONT> times.</TD></TR>
<TR><TD COLSPAN=2><BR>A <TT><B>\</B></TT> escapes any special meaning
of the following character if non-alphanumeric, but it turns most alphanumeric characters
into something special:<BR><BR></TD></TR>
<TR><TD VALIGN=top><TT><B>\w</B></TT></TD>
<TD>matches alphanumeric, including <TT><B>_</B></TT>,
<TT><B>\W</B></TT> matches non-alphanumeric.</TD></TR>
<TR><TD VALIGN=top><TT><B>\s</B></TT></TD>
<TD>matches whitespace, <TT><B>\S</B></TT> matches non-whitespace.</TD></TR>
<TR><TD VALIGN=top><TT><B>\d</B></TT></TD>
<TD>matches numeric, <TT><B>\D</B></TT> matches non-numeric.</TD></TR>
<TR><TD VALIGN=top><TT><B>\A</B></TT></TD>
<TD>matches the beginning of the string, <TT><B>\Z</B></TT> matches the end.</TD></TR>
<TR><TD VALIGN=top><TT><B>\b</B></TT></TD>
<TD>matches word boundaries, <TT><B>\B</B></TT> matches non-boundaries.</TD></TR>
<TR><TD VALIGN=top><TT><B>\G</B></TT></TD>
<TD>matches where the previous <B>m//g</B> search left off.</TD></TR>
<TR><TD><TT><B>\n</B></TT>, <TT><B>\r</B></TT>, <TT><B>\f</B></TT>, <TT><B>\t</B></TT></TD>
<TD>etc. have their usual meaning.</TD></TR>
<TR><TD><TT><B>\w</B></TT>, <TT><B>\s</B></TT> and <TT><B>\d</B></TT></TD>
<TD>may be used within character classes,
<TT><B>\b</B></TT> denotes backspace in this context.</TD></TR>
<TR><TD COLSPAN=2><BR>Back-references:<BR><BR></TD></TR>
<TR><TD VALIGN=top><TT><B>\1</B></TT> ... <TT><B>\9</B></TT></TD>
<TD>refer to matched subexpressions, grouped with <TT><B>()</B></TT>,
inside the match.</TD></TR>
<TR><TD VALIGN=top><TT><B>\10</B></TT></TD>
<TD>and up can also be used if the pattern matches that many subexpressions.</TD></TR>
</TABLE>
<P>See also <TT><B>$1</B></TT> ... <TT><B>$9</B></TT>,<TT><B> $+</B></TT>,<TT><B> $&amp;</B></TT>,<TT><B> $`</B></TT>, and<TT><B> $' </B></TT>
in section <A HREF="#specialvariables">Special Variables</A>.</P>
<P>With modifier <B>x</B>, whitespace can be used in the patterns for
readability purposes.</P>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="search"></A>
<H2>Search and Replace Functions</H2>
<DL>
<DT>[ <FONT SIZE="-1">EXPR</FONT> <TT><B>=~</B></TT> ] [ <B>m</B> ] <TT><B>/</B></TT><FONT SIZE="-1">PATTERN</FONT><TT><B>/</B></TT>
[ <B>g</B> ] [ <B>i</B> ] [ <B>m</B> ] [ <B>o</B> ] [ <B>v</B> ] [ <B>x</B> ]
<DD>Searches <FONT SIZE="-1">EXPR</FONT> (default: <TT><B>$_</B></TT>) for a pattern. If you
prepend an <B>m</B> you can use almost any pair of delimiters
instead of the slashes. If used in array context,
an array is returned consisting of the subexpressions
matched by the parentheses in the pattern, i.e., <TT><B>($1,$2,$3,</B></TT>...<TT><B>)</B></TT>.
<BR>
Optional modifiers: <B>g</B> matches as many times as
possible; <B>i</B> searches in a case-insensitive manner; <B>o</B>
interpolates variables only once. <B>m</B> treats the string
as multiple lines; <B>s</B> treats the string as a single line; <B>x</B>
allows for regular expression extensions.
<BR>
If <FONT SIZE="-1">PATTERN</FONT> is empty, the most recent pattern from a
previous match or replacement is used.
<BR>
With <B>g</B> the match can be used as an iterator in scalar
context.
<DT><TT><B>?</B></TT><FONT SIZE="-1">PATTERN</FONT><TT><B>?</B></TT>
<DD>This is just like the <TT><B>/</B></TT><FONT SIZE="-1">PATTERN</FONT><TT><B>/</B></TT> search, except that it
matches only once between calls to the <B>reset</B> operator.
<DT>[ <TT><B>$</B></TT><FONT SIZE="-1">VAR</FONT> <TT><B>=~</B></TT> ] <B>s</B><TT><B>/</B></TT><FONT SIZE="-1">PATTERN</FONT><TT><B>/</B></TT><FONT SIZE="-1">REPLACEMENT</FONT><TT><B>/</B></TT>
[ <B>e</B> ] [ <B>g</B> ] [ <B>i</B> ] [ <B>m</B> ] [ <B>o</B> ] [ <B>s</B> ] [ <B>x</B> ]
<DD>Searches a string for a pattern, and if found, replaces
that pattern with the replacement text. It returns the
number of substitutions made, if any; if no substitutions are made, it
returns <STRONG>false</STRONG>.
<BR>
Optional modifiers: <B>g</B> replaces all occurrences of the
pattern; <B>e</B> evaluates the replacement string as a Perl
expression; for any other modifiers, see <TT><B>/</B></TT><FONT SIZE="-1">PATTERN</FONT><TT><B>/</B></TT>
matching. Almost any delimiter may replace the
slashes; if single quotes are used, no interpretation is
done on the strings between the delimiters, otherwise
the strings are interpolated as if inside double quotes.
<BR>
If bracketing delimiters are used, <FONT SIZE="-1">PATTERN</FONT> and
<FONT SIZE="-1">REPLACEMENT</FONT> may have their own delimiters, e.g.,
<TT><B>s(foo)[bar]</B></TT>. If <FONT SIZE="-1">PATTERN</FONT> is empty, the most recent pattern
from a previous match or replacement is used.
<DT>[ <TT><B>$</B></TT><FONT SIZE="-1">VAR</FONT> <TT><B>=~</B></TT> ] <B>tr</B><TT><B>/</B></TT><FONT SIZE="-1">SEARCHLIST</FONT><TT><B>/</B></TT><FONT SIZE="-1">REPLACEMENTLIST</FONT><TT><B>/</B></TT>
[ <B>c</B> ] [ <B>d</B> ] [ <B>s</B> ]
<DD>Translates all occurrences of the characters found in
the search list with the corresponding character in
the replacement list. It returns the number of characters
replaced. <B>y</B> may be used instead of <B>tr</B>.
<BR>
Optional modifiers: <B>c</B> complements the <FONT SIZE="-1">SEARCHLIST</FONT>;
<B>d</B> deletes all characters found in <FONT SIZE="-1">SEARCHLIST</FONT> that do
not have a corresponding character in
<FONT SIZE="-1">REPLACEMENTLIST</FONT>; <B>s</B> squeezes all
sequences of characters that are translated into the same target character
into one occurrence of this character.
<DT><B>pos</B> <FONT SIZE="-1">SCALAR</FONT>
<DD>Returns the position where the last <B>m//g</B> search left off
for <FONT SIZE="-1">SCALAR</FONT>. May be assigned to.
<DT><B>study</B> [ <TT><B>$</B></TT><FONT SIZE="-1">VAR&#134;</FONT> ]
<DD>Study the scalar variable <TT><B>$</B></TT><FONT SIZE="-1">VAR</FONT> in anticipation of
performing many pattern matches on its contents
before the variable is next modified.
</DL>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="filetest"></A>
<H2>File Test Operators</H2>
These unary operators takes one argument, either a filename
or a filehandle, and test the associated file to see if something
is true about it. If the argument is omitted, they test <TT><B>$_</B></TT>
(except for <TT><B>-t</B></TT>, which tests <TT><B>STDIN</B></TT>). If the special argument <TT><B>_</B></TT>
(underscore) is passed, they use the information from the preceding test or <B>stat</B> call.
<P>
<TABLE CELLSPACING=0 CELLPADDING=0>
<TR><TD VALIGN=top NOWRAP><TT><B>-r -w -x&nbsp;</B></TT></TD>
<TD VALIGN=top>File is readable/writable/executable by effective uid/gid.</TD></TR>
<TR><TD VALIGN=top NOWRAP><TT><B>-R -W -X</B></TT></TD>
<TD VALIGN=top>File is readable/writable/executable by real uid/gid.</TD></TR>
<TR><TD VALIGN=top NOWRAP><TT><B>-o -O</B></TT></TD>
<TD VALIGN=top>File is owned by effective/real uid.</TD></TR>
<TR><TD VALIGN=top><TT><B>-e -z</B></TT></TD>
<TD VALIGN=top>File exists/has zero size.</TD></TR>
<TR><TD VALIGN=top><TT><B>-s</B></TT></TD>
<TD VALIGN=top>File exists and has non-zero size. Returns the size.</TD></TR>
<TR><TD VALIGN=top><TT><B>-f -d</B></TT></TD>
<TD VALIGN=top>File is a plain file/a directory.</TD></TR>
<TR><TD VALIGN=top><TT><B>-l -S -p</B></TT></TD>
<TD VALIGN=top>File is a symbolic link/a socket/a named pipe (FIFO).</TD></TR>
<TR><TD VALIGN=top><TT><B>-b -c</B></TT></TD>
<TD VALIGN=top>File is a block/character special file.</TD></TR>
<TR><TD VALIGN=top><TT><B>-u -g -k</B></TT></TD>
<TD VALIGN=top>File has setuid/setgid/sticky bit set.</TD></TR>
<TR><TD VALIGN=top><TT><B>-t</B></TT></TD>
<TD VALIGN=top>Tests if filehandle (<TT><B>STDIN</B></TT> by default) is opened to a tty.</TD></TR>
<TR><TD VALIGN=top><TT><B>-T -B</B></TT></TD>
<TD VALIGN=top>File is a text/non-text (binary) file.
<TT><B>-T</B></TT> and <TT><B>-B</B></TT> return <B>true</B> on a null file,
or a file at EOF when testing a filehandle.</TD></TR>
<TR><TD VALIGN=top><TT><B>-M -A -C</B></TT></TD>
<TD VALIGN=top>File modification / access / inode-change time.
Measured in days. Value returned reflects the file age at
the time the script started. See also <TT><B>$^T</B></TT> in the section
<A HREF="#specialvariables">Special Variables</A>.</TD></TR>
</TABLE>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="fileoperations"></A>
<H2>File Operations</H2>
Functions operating on a list of files return the number of files successfully
operated upon.
<DL>
<DT><B>chmod</B> <FONT SIZE="-1">LIST</FONT>
<DD>Changes the permissions of a list of files.
The first element of the list must be the numerical mode.
<DT><B>chown</B> <FONT SIZE="-1">LIST</FONT>
<DD>Changes the owner and group of a list of files.
The first two elements of the list must be the numerical uid and gid.
<DT><B>truncate</B> <FONT SIZE="-1">FILE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SIZE</FONT>
<DD>Truncates <FONT SIZE="-1">FILE</FONT> to <FONT SIZE="-1">SIZE</FONT>.
<FONT SIZE="-1">FILE</FONT> may be a filename or a filehandle.
<DT><B>link</B> <FONT SIZE="-1">OLDFILE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">NEWFILE</FONT>
<DD>Creates a new filename linked to the old filename.
<DT><B>lstat</B> <FONT SIZE="-1">FILE</FONT>
<DD>Like <B>stat</B>, but does not traverse a final symbolic link.
<DT><B>mkdir</B> <FONT SIZE="-1">DIR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">MODE</FONT>
<DD>Creates a directory with given permissions.
Sets <TT><B>$!</B></TT> on failure.
<DT><B>readlink</B> <FONT SIZE="-1">EXPR&#134;</FONT>
<DD>Returns the value of a symbolic link.
<DT><B>rename</B> <FONT SIZE="-1">OLDNAME</FONT><TT><B>,</B></TT> <FONT SIZE="-1">NEWNAME</FONT>
<DD>Changes the name of a file.
<DT><B>rmdir</B> <FONT SIZE="-1">FILENAME&#134;</FONT>
<DD>Deletes the directory if it is empty.
Sets <TT><B>$!</B></TT> on failure.
<DT><B>stat</B> <FONT SIZE="-1">FILE</FONT>
<DD>Returns a 13-element array
(0:&nbsp;<TT><B>$</B></TT>dev,
1:&nbsp;<TT><B>$</B></TT>ino,
2:&nbsp;<TT><B>$</B></TT>mode,
3:&nbsp;<TT><B>$</B></TT>nlink,
4:&nbsp;<TT><B>$</B></TT>uid,
5:&nbsp;<TT><B>$</B></TT>gid,
6:&nbsp;<TT><B>$</B></TT>rdev,
7:&nbsp;<TT><B>$</B></TT>size,
8:&nbsp;<TT><B>$</B></TT>atime,
9:&nbsp;<TT><B>$</B></TT>mtime,
10:&nbsp;<TT><B>$</B></TT>ctime,
11:&nbsp;<TT><B>$</B></TT>blksize,
12:&nbsp;<TT><B>$</B></TT>blocks).
<FONT SIZE="-1">FILE</FONT> can be a filehandle, an expression evaluating to a filename,
or <TT><B>_</B></TT> to refer to the last file test operation or <B>stat</B> call.
Returns a null list if the <B>stat</B> fails.
<DT><B>symlink</B> <FONT SIZE="-1">OLDFILE</FONT>, <FONT SIZE="-1">NEWFILE</FONT>
<DD>Creates a new filename symbolically linked to the old filename.
<DT><B>unlink</B> <FONT SIZE="-1">LIST</FONT>
<DD>Deletes a list of files.
<DT><B>utime</B> <FONT SIZE="-1">LIST</FONT>
<DD>Changes the access and modification times.
The first two elements of the list must be the numerical access and modification times.
</DL>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="input"></A>
<H2>Input / Output</H2>
In input/output operations, <FONT SIZE="-1">FILEHANDLE</FONT> may be a
filehandle as opened by the <B>open</B> operator, a predefined filehandle
(e.g., <TT><B>STDOUT</B></TT>) or a scalar variable that evaluates to the name of a
filehandle to be used.
<DL>
<DT><TT><B>&lt;</B></TT><FONT SIZE="-1">FILEHANDLE</FONT><TT><B>&gt;</B></TT>
<DD>In scalar context, reads a single line from the file opened on <FONT SIZE="-1">FILEHANDLE</FONT>.
In array context, reads the whole file.
<DT><TT><B>&lt;</B></TT> <TT><B>&gt;</B></TT>
<DD>Reads from the input stream formed by the files specified in
<TT><B>@ARGV</B></TT>, or standard input if no arguments were supplied.
<DT><B>binmode</B> <FONT SIZE="-1">FILEHANDLE</FONT>
<DD>Arranges for the file opened on <FONT SIZE="-1">FILEHANDLE</FONT> to be read
or written in <I>binary</I> mode as opposed to <I>text</I> mode (null operation on UNIX).
<DT><B>close</B> <FONT SIZE="-1">FILEHANDLE</FONT>
<DD>Closes the file or pipe associated with the filehandle.
<DT><B>dbmclose</B> <TT><B>%</B></TT><FONT SIZE="-1">HASH</FONT>
<DD>Depreciated, use <B>untie</B> instead.
<DT><B>dbmopen</B> <TT><B>%</B></TT><FONT SIZE="-1">HASH</FONT><TT><B>,</B></TT> <FONT SIZE="-1">DBMNAME</FONT><TT><B>,</B></TT> <FONT SIZE="-1">MODE</FONT>
<DD>Depreciated, use <B>tie</B> instead.
<DT><B>eof</B> <FONT SIZE="-1">FILEHANDLE</FONT>
<DD>Returns <B>true</B> if the next read will return end of file, or
if the file is not open.
<DT><B>eof</B>
<DD>Returns the EOF status for the last file read.
<DT><B>eof</B><TT><B>()</B></TT>
<DD>Indicates EOF on the pseudo file formed of the files
listed on the command line.
<DT><B>fcntl</B> <FONT SIZE="-1">FILEHANDLE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">FUNCTION</FONT><TT><B>,</B></TT> <TT><B>$</B></TT><FONT SIZE="-1">VAR</FONT>
<DD>Implements the <I>fcntl</I>(2) function. This function has
non-standard return values.
<DT><B>fileno</B> <FONT SIZE="-1">FILEHANDLE</FONT>
<DD>Returns the file descriptor for a given (open) file.
<DT><B>flock</B> <FONT SIZE="-1">FILEHANDLE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">OPERATION</FONT>
<DD>Calls <I>flock</I>(2) on the file.
<FONT SIZE="-1">OPERATION</FONT> formed by
adding 1 (shared),
2 (exclusive), 4 (non-blocking), or 8 (unlock).
<DT><B>getc</B> [ <FONT SIZE="-1">FILEHANDLE</FONT> ]
<DD>Yields the next character from the file, or an empty
string on end of file. If <FONT SIZE="-1">FILEHANDLE</FONT> is omitted, reads
from <TT><B>STDIN</B></TT>.
<DT><B>ioctl</B> <FONT SIZE="-1">FILEHANDLE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">FUNCTION</FONT><TT><B>,</B></TT> <TT><B>$</B></TT><FONT SIZE="-1">VAR</FONT>
<DD>Performs <I>ioctl</I>(2) on the file. This function has non-standard
return values.
<DT><B>open</B> <FONT SIZE="-1">FILEHANDLE</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">FILENAME</FONT> ]
<DD>Opens a file and associates it with <FONT SIZE="-1">FILEHANDLE</FONT>. If
<FONT SIZE="-1">FILENAME</FONT> is omitted, the scalar variable of the same
name as the <FONT SIZE="-1">FILEHANDLE</FONT> must contain the filename.
<BR>
The following filename conventions apply when
opening a file.
<BR>
<TABLE CELLSPACING=0 CELLPADDING=0>
<TR><TD><TT><B>"</B></TT><FONT SIZE="-1">FILE</FONT><TT><B>"</B></TT></TD>
<TD>open <FONT SIZE="-1">FILE</FONT> for input.
Also <TT><B>"&lt;</B></TT><FONT SIZE="-1">FILE</FONT><TT><B>"</B></TT>.</TD></TR>
<TR><TD><TT><B>"&gt;</B></TT><FONT SIZE="-1">FILE</FONT><TT><B>"</B></TT></TD>
<TD>open <FONT SIZE="-1">FILE</FONT> for output, creating it if necessary.</TD></TR>
<TR><TD><TT><B>"&gt;&gt;</B></TT><FONT SIZE="-1">FILE</FONT><TT><B>"</B></TT></TD>
<TD>open <FONT SIZE="-1">FILE</FONT> in append mode.</TD></TR>
<TR><TD><TT><B>"+&gt;</B></TT><FONT SIZE="-1">FILE</FONT><TT><B>"</B></TT></TD>
<TD>open <FONT SIZE="-1">FILE</FONT> with read/write access.</TD></TR>
<TR><TD><TT><B>"|</B></TT><FONT SIZE="-1">CMD</FONT><TT><B>"</B></TT></TD>
<TD>opens a pipe to command <FONT SIZE="-1">CMD</FONT>;
forks if <FONT SIZE="-1">CMD</FONT> is <TT><B>-</B></TT>.</TD></TR>
<TR><TD><TT><B>"</B></TT><FONT SIZE="-1">CMD</FONT><TT><B>|"</B></TT></TD>
<TD>opens a pipe from command <FONT SIZE="-1">CMD</FONT>;
forks if <FONT SIZE="-1">CMD</FONT> is <TT><B>-</B></TT>.</TD></TR>
</TABLE>
<FONT SIZE="-1">FILE</FONT> may be <TT><B>&amp;</B></TT><FONT SIZE="-1">FILEHND</FONT>
in which case the new filehandle is connected to the (previously opened)
filehandle <FONT SIZE="-1">FILEHND</FONT>.
If it is <TT><B>&amp;=</B></TT><FONT SIZE="-1">N</FONT>, <FONT SIZE="-1">FILE</FONT> will be connected to the given file descriptor.
<B>open</B> returns <B>undef</B> upon failure, <B>true</B> otherwise.
<DT><B>pipe</B> <FONT SIZE="-1">READHANDLE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">WRITEHANDLE</FONT><TT><B>)</B></TT>
<DD>Returns a pair of connected pipes.
<DT><B>print</B> [ <FONT SIZE="-1">FILEHANDLE</FONT> ] [ <FONT SIZE="-1">LIST&#134;</FONT> ]
<DD>Equivalent to <B>print</B> <FONT SIZE="-1">FILEHANDLE</FONT> <B>sprintf</B> <FONT SIZE="-1">LIST</FONT>.
<DT><B>printf</B>[<TT><B>(</B></TT>[<FONT SIZE="-1">FILEHANDLE</FONT>] <FONT SIZE="-1">LIST&#134;</FONT><TT><B>)</B></TT>*]
<DD>Equivalent to <B>print</B> <FONT SIZE="-1">FILEHANDLE</FONT>
<B>sprintf</B><TT><B>(</B></TT><FONT SIZE="-1">LIST</FONT><TT><B>)</B></TT>.
<DT><B>read</B> <FONT SIZE="-1">FILEHANDLE</FONT><TT><B>,</B></TT> <TT><B>$</B></TT><FONT SIZE="-1">VAR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LENGTH</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">OFFSET</FONT> ]
<DD>Reads <FONT SIZE="-1">LENGTH</FONT> binary bytes from the file into the
variable at <FONT SIZE="-1">OFFSET</FONT>. Returns number of bytes actually read.
<DT><B>seek</B> <FONT SIZE="-1">FILEHANDLE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">POSITION</FONT><TT><B>,</B></TT> <FONT SIZE="-1">WHENCE</FONT>
<DD>Arbitarily positions the file.
Returns <B>true</B> if successful.
<DT><B>select</B> [ <FONT SIZE="-1">FILEHANDLE</FONT> ]
<DD>Returns the currently selected filehandle. Sets the
current default filehandle for output operations if
<FONT SIZE="-1">FILEHANDLE</FONT> is supplied.
<DT><B>select</B> <FONT SIZE="-1">RBITS</FONT><TT><B>,</B></TT> <FONT SIZE="-1">WBITS</FONT><TT><B>,</B></TT> <FONT SIZE="-1">NBITS</FONT><TT><B>,</B></TT> <FONT SIZE="-1">TIMEOUT</FONT>
<DD>Performs a <I>select</I>(2) system call with the same
parameters.
<DT><B>sprintf</B> <FONT SIZE="-1">FORMAT</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LIST</FONT>
<DD>Returns a string formatted by (almost all of) the
usual <I>printf</I>(3) conventions.
<DT><B>sysread</B> <FONT SIZE="-1">FILEHANDLE</FONT><TT><B>,</B></TT> <TT><B>$</B></TT><FONT SIZE="-1">VAR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LENGTH</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">OFFSET</FONT> ]
<DD>Reads <FONT SIZE="-1">LENGTH</FONT> bytes into
<TT><B>$</B></TT><FONT SIZE="-1">VAR</FONT> at <FONT SIZE="-1">OFFSET</FONT>.
<DT><B>syswrite</B> <FONT SIZE="-1">FILEHANDLE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SCALAR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LENGTH</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">OFFSET</FONT> ]
<DD>Writes <FONT SIZE="-1">LENGTH</FONT> bytes from <FONT SIZE="-1">SCALAR</FONT> at <FONT SIZE="-1">OFFSET</FONT>.
<DT><B>tell</B> [ <FONT SIZE="-1">FILEHANDLE</FONT> ]
<DD>Returns the current file position for the file.
If <FONT SIZE="-1">FILENAME</FONT> is omitted, assumes the file last read.
<DT><B>write</B> [ <FONT SIZE="-1">FILEHANDLE</FONT> ]
<DD>Writes a formatted record to the specified file, using the format associated
with that file.
</DL>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="formats"></A>
<H2>Formats</H2>
<DL>
<DT><B>formline</B> <FONT SIZE="-1">PICTURE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LIST</FONT>
<DD>Formats <FONT SIZE="-1">LIST</FONT> according to <FONT SIZE="-1">PICTURE</FONT>
and accumulates the result into <TT><B>$^A</B></TT>.
<DT><B>write</B> [ <FONT SIZE="-1">FILEHANDLE</FONT> ]
<DD>Writes a formatted record to the specified file, using the format associated
with that file.
</DL>
<P>Formats are defined as follows:</P>
<UL>
<B>format</B> [<FONT SIZE="-1">NAME</FONT>] <TT><B>=</B></TT><BR>
<FONT SIZE="-1">FORMLIST</FONT><BR>
<TT><B>.</B></TT>
</UL>
<P><FONT SIZE="-1">FORMLIST</FONT> pictures the lines, and contains the arguments which will
give values to the fields in the lines. <FONT SIZE="-1">NAME</FONT> defaults to
<TT><B>STDOUT</TT></B> if omitted.</P>
<P>Picture fields are:</P>
<UL>
<TABLE CELLSPACING=0 CELLPADDING=0>
<TR>
<TD><TT><B>@&lt;&lt;&lt;</B></TT>...</TD>
<TD>left adjusted field, repeat the <TT><B>&lt;</B></TT> to denote the desired width</TD>
</TR>
<TR>
<TD><TT><B>@&gt;&gt;&gt;</B></TT>...</TD>
<TD>right adjusted field</TD>
</TR>
<TR>
<TD><TT><B>@|||</B></TT>...</TD>
<TD>centered field</TD>
</TR>
<TR>
<TD><TT><B>@#.##</B></TT>...&nbsp;&nbsp;&nbsp;</TD>
<TD>numeric format with implied decimal point</TD>
</TR>
<TR>
<TD><TT><B>@*</B></TT></TD>
<TD>a multi-line field</TD>
</TR>
</TABLE>
</UL>
Use <TT><B>^</B></TT> instead of <TT><B>@</B></TT> for multiline block filling.<BR>
Use <TT><B>~</B></TT> at the beginning of a line to suppress unwanted empty lines.<BR>
Use <TT><B>~~</B></TT> at the beginning of a line to have this format line repeated until
all fields are exhausted.<BR>
Use <TT><B>$-</B></TT> to zero to force a page break on the next <B>write</B>.<BR>
See also <TT><B>$^</B></TT>, <TT><B>$~</B></TT>, <TT><B>$^A</B></TT>, <TT><B>$^F</B></TT>,
<TT><B>$-</B></TT> and <TT><B>$=</B></TT> in section
<A HREF="#specialvariables">Special Variables</A>.
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="directory"></A>
<H2>Directory Reading Routines</H2>
<DL>
<DT><B>closedir</B> <FONT SIZE="-1">DIRHANDLE</FONT>
<DD>Closes a directory opened by <B>opendir</B>.
<DT><B>opendir</B> <FONT SIZE="-1">DIRHANDLE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">DIRNAME</FONT>
<DD>Opens a directory on the handle specified.
<DT><B>readdir</B> <FONT SIZE="-1">DIRHANDLE</FONT>
<DD>Returns the next entry (or an array of entries) from the directory.
<DT><B>rewinddir</B> <FONT SIZE="-1">DIRHANDLE</FONT>
<DD>Positions the directory to the beginning.
<DT><B>seekdir</B> <FONT SIZE="-1">DIRHANDLE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">POS</FONT>
<DD>Sets position for <B>readdir</B> on the directory.
<DT><B>telldir</B> <FONT SIZE="-1">DIRHANDLE</FONT>
<DD>Returns the position in the directory.
</DL>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="systeminteraction"></A>
<H2>System Interaction</H2>
<DL>
<DT><B>alarm</B> <FONT SIZE="-1">EXPR</FONT>
<DD>Schedules a <TT><B>SIGALRM</B></TT> to be delivered
after <FONT SIZE="-1">EXPR</FONT> seconds.
<DT><B>chdir</B> [ <FONT SIZE="-1">EXPR</FONT> ]
<DD>Changes the working directory.
Uses <TT><B>$ENV{"HOME"}</TT></B> or <TT><B>$ENV{"LOGNAME"}</TT></B> if <FONT SIZE="-1">EXPR</FONT> is omitted.
<DT><B>chroot</B> <FONT SIZE="-1">FILENAME&#134;</FONT>
<DD>Changes the root directory for the process and its children.
<DT><B>die</B> [ <FONT SIZE="-1">LIST</FONT> ]
<DD>Prints the value of <FONT SIZE="-1">LIST</FONT> to <TT><B>STDERR</B></TT>
and exits with the current value of <TT><B>$!</B></TT> (errno).
If <TT><B>$!</B></TT> is 0, exits with the value of <TT><B>($? &gt;&gt; 8)</B></TT>.
If <TT><B>($? &gt;&gt; 8)</B></TT> is 0, exits with 255.
<FONT SIZE="-1">LIST</FONT> defaults to "<TT><B>Died</B></TT>".
<DT><B>exec</B> <FONT SIZE="-1">LIST</FONT>
<DD>Executes the system command in <FONT SIZE="-1">LIST</FONT>; does not return.
<DT><B>exit</B> <FONT SIZE="-1">EXPR</FONT>
<DD>Exits immediately with the value of <FONT SIZE="-1">EXPR</FONT>,
which defaults to <TT><B>0</TT></B> (zero).
Calls <TT><B>END</TT></B> routines and object destructors before exiting.
<DT><B>fork</B>
<DD>Does a <I>fork</I>(2) system call.
Returns the process ID of the child to the parent process and zero to the child process.
<DT><B>getlogin</B>
<DD>Returns the current login name as known by the system.
<DT><B>getpgrp</B> [ <FONT SIZE="-1">PID</FONT> ]
<DD>Returns the process group for process <FONT SIZE="-1">PID</FONT>
(0, or omitted, means the current process).
<DT><B>getppid</B>
<DD>Returns the process ID of the parent process.
<DT><B>getpriority</B> <FONT SIZE="-1">WHICH</FONT><TT><B>,</B></TT> <FONT SIZE="-1">WHO</FONT>
<DD>Returns the current priority for a process, process group, or user.
<DT><B>glob</B> <FONT SIZE="-1">PAT</FONT>
<DD>Returns a list of filenames that match the shell pattern <FONT SIZE="-1">PAT</FONT>.
<DT><B>kill</B> <FONT SIZE="-1">LIST</FONT>
<DD>Sends a signal to a list of processes.
The first element of the list must be the signal to send
(either numeric, or its name as a string).
<DT><B>setpgrp</B> <FONT SIZE="-1">PID</FONT><TT><B>,</B></TT> <FONT SIZE="-1">PGRP</FONT>
<DD>Sets the process group for the <FONT SIZE="-1">PID</FONT> (0 means the current process).
<DT><B>setpriority</B> <FONT SIZE="-1">WHICH</FONT><TT><B>,</B></TT> <FONT SIZE="-1">WHO</FONT><TT><B>,</B></TT> <FONT SIZE="-1">PRIORITY</FONT>
<DD>Sets the current priority for a process, process group, or a user.
<DT><B>sleep</B> [ <FONT SIZE="-1">EXPR</FONT> ]
<DD>Causes the program to sleep for <FONT SIZE="-1">EXPR</FONT> seconds,
or forever if no <FONT SIZE="-1">EXPR</FONT>.
Returns the number of seconds actually slept.
<DT><B>syscall</B> <FONT SIZE="-1">LIST</FONT>
<DD>Calls the system call specified in the first element of the list, passing the
rest of the list as arguments to the call.
<DT><B>system</B> <FONT SIZE="-1">LIST</FONT>
<DD>Does exactly the same thing as <B>exec</B> <FONT SIZE="-1">LIST</FONT>
except that a fork is performed first,
and the parent process waits for the child process to complete.
<DT><B>times</B>
<DD>Returns a 4-element array
(0:&nbsp;<TT><B>$</B></TT>user,
1:&nbsp;<TT><B>$</B></TT>system,
2:&nbsp;<TT><B>$</B></TT>cursor,
3:&nbsp;<TT><B>$</B></TT>csystem)
giving the user and system times, in seconds, for this process
and the children of this process.
<DT><B>umask</B> [ <FONT SIZE="-1">EXPR</FONT> ]
<DD>Sets the umask for the process and returns the old one.
If <FONT SIZE="-1">EXPR</FONT> is omitted, returns current umask value.
<DT><B>wait</B>
<DD>Waits for a child process to terminate and returns the process ID of the
deceased process (-1 if none). The status is returned in <TT><B>$?</B></TT>.
<DT><B>waitpid</B> <FONT SIZE="-1">PID</FONT><TT><B>,</B></TT> <FONT SIZE="-1">FLAGS</FONT>
<DD>Performs the same function as the corresponding system call.
<DT><B>warn</B> [ <FONT SIZE="-1">LIST</FONT> ]
<DD>Prints the message on <TT><B>STDERR</B></TT> like <B>die</B>, but doesn't exit.
<FONT SIZE="-1">LIST</FONT> defaults to "<TT><B>Warning: something's wrong</TT></B>".
</DL>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="networking"></A>
<H2>Networking</H2>
<DL>
<DT><B>accept</B> <FONT SIZE="-1">NEWSOCKET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">GENERICSOCKET</FONT>
<DD>Accepts a new socket.
<DT><B>bind</B> <FONT SIZE="-1">SOCKET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">NAME</FONT>
<DD>Binds the <FONT SIZE="-1">NAME</FONT> to the <FONT SIZE="-1">SOCKET</FONT>.
<DT><B>connect</B> <FONT SIZE="-1">SOCKET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">NAME</FONT>
<DD>Connects the <FONT SIZE="-1">NAME</FONT> to the <FONT SIZE="-1">SOCKET</FONT>.
<DT><B>getpeername</B> <FONT SIZE="-1">SOCKET</FONT>
<DD>Returns the socket address of the other end of the <FONT SIZE="-1">SOCKET</FONT>.
<DT><B>getsockname</B> <FONT SIZE="-1">SOCKET</FONT>
<DD>Returns the name of the <FONT SIZE="-1">SOCKET</FONT>.
<DT><B>getsockopt</B> <FONT SIZE="-1">SOCKET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LEVEL</FONT><TT><B>,</B></TT> <FONT SIZE="-1">OPTNAME</FONT>
<DD>Returns the socket options.
<DT><B>listen</B> <FONT SIZE="-1">SOCKET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">QUEUESIZE</FONT>
<DD>Starts listening on the specified <FONT SIZE="-1">SOCKET</FONT>.
<DT><B>recv</B> <FONT SIZE="-1">SOCKET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SCALAR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LENGTH</FONT><TT><B>,</B></TT> <FONT SIZE="-1">FLAGS</FONT>
<DD>Receives a message on <FONT SIZE="-1">SOCKET</FONT>.
<DT><B>send</B> <FONT SIZE="-1">SOCKET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">MSG</FONT><TT><B>,</B></TT> <FONT SIZE="-1">FLAGS</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">TO</FONT> ]
<DD>Sends a message on the <FONT SIZE="-1">SOCKET</FONT>.
<DT><B>setsockopt</B> <FONT SIZE="-1">SOCKET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LEVEL</FONT><TT><B>,</B></TT> <FONT SIZE="-1">OPTNAME</FONT><TT><B>,</B></TT> <FONT SIZE="-1">OPTVAL</FONT>
<DD>Sets the requested socket option.
<DT><B>shutdown</B> <FONT SIZE="-1">SOCKET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">HOW</FONT>
<DD>Shuts down a <FONT SIZE="-1">SOCKET</FONT>.
<DT><B>socket</B> <FONT SIZE="-1">SOCKET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">DOMAIN</FONT><TT><B>,</B></TT> <FONT SIZE="-1">TYPE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">PROTOCOL</FONT>
<DD>Creates a <FONT SIZE="-1">SOCKET</FONT> in <FONT SIZE="-1">DOMAIN</FONT> with <FONT SIZE="-1">TYPE</FONT> and <FONT SIZE="-1">PROTOCOL</FONT>.
<DT><B>socketpair</B> <FONT SIZE="-1">SOCKET1</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SOCKET2</FONT><TT><B>,</B></TT> <FONT SIZE="-1">DOMAIN</FONT><TT><B>,</B></TT> <FONT SIZE="-1">TYPE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">PROTOCOL</FONT>
<DD>Works the same as <B>socket</B>, but creates a pair of bidirectional sockets.
</DL>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="systemv"></A>
<H2>System V IPC</H2>
<P>You need to<TT><B> require "sys/ipc.ph" </TT></B>before you can use the
symbolic names of the operations.</P>
<DL>
<DT><B>msgctl</B> <FONT SIZE="-1">ID</FONT><TT><B>,</B></TT> <FONT SIZE="-1">CMD</FONT><TT><B>,</B></TT> <FONT SIZE="-1">ARGS</FONT>
<DD>Calls <I>msgctl</I>(2). If <FONT SIZE="-1">CMD</FONT> is <TT><B>&amp;IPC_STAT</TT></B> then <FONT SIZE="-1">ARGS</FONT> must
be a variable.
<DT><B>msgget</B> <FONT SIZE="-1">KEY</FONT><TT><B>,</B></TT> <FONT SIZE="-1">FLAGS</FONT>
<DD>Creates a message queue for <FONT SIZE="-1">KEY</FONT>.
Returns the message queue identifier.
<DT><B>msgsnd</B> <FONT SIZE="-1">ID</FONT><TT><B>,</B></TT> <FONT SIZE="-1">MSG</FONT><TT><B>,</B></TT> <FONT SIZE="-1">FLAGS</FONT>
<DD>Sends <FONT SIZE="-1">MSG</FONT> to queue <FONT SIZE="-1">ID</FONT>.
<DT><B>msgrcv</B> <FONT SIZE="-1">ID</FONT><TT><B>,</B></TT> <TT><B>$</TT></B><FONT SIZE="-1">VAR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SIZE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">TYPE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">FLAGS</FONT>
<DD>Receives a message from queue <FONT SIZE="-1">ID</FONT> into <FONT SIZE="-1">VAR</FONT>.
<DT><B>semctl</B> <FONT SIZE="-1">ID</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SEMNUM</FONT><TT><B>,</B></TT> <FONT SIZE="-1">CMD</FONT><TT><B>,</B></TT> <FONT SIZE="-1">ARG</FONT>
<DD>Calls <I>semctl</I>(2).
If <FONT SIZE="-1">CMD</FONT> is <TT><B>&amp;IPC_STAT</TT></B> of <TT><B>&amp;GETALL</TT></B>
then <FONT SIZE="-1">ARG</FONT> must be a variable.
<DT><B>semget</B> <FONT SIZE="-1">KEY</FONT><TT><B>,</B></TT> <FONT SIZE="-1">NSEMS</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SIZE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">FLAGS</FONT>
<DD>Creates a set of semaphores for <FONT SIZE="-1">KEY</FONT>.
Returns the message semaphore identifier.
<DT><B>semop</B> <FONT SIZE="-1">KEY</FONT><TT><B>,</B></TT> ...
<DD>Performs semaphore operations.
<DT><B>shmctl</B> <FONT SIZE="-1">ID</FONT><TT><B>,</B></TT> <FONT SIZE="-1">CMD</FONT><TT><B>,</B></TT> <FONT SIZE="-1">ARG</FONT>
<DD>Calls <I>shmctl</I>(2).
If <FONT SIZE="-1">CMD</FONT> is <TT><B>&amp;IPC_STAT</TT></B>
then <FONT SIZE="-1">ARG</FONT> must be a variable.
<DT><B>shmget</B> <FONT SIZE="-1">KEY</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SIZE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">FLAGS</FONT>
<DD>Creates shared memory.
Returns the shared memory segment identifier.
<DT><B>shmread</B> <FONT SIZE="-1">ID</FONT><TT><B>,</B></TT> <TT><B>$</TT></B><FONT SIZE="-1">VAR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">POS</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SIZE</FONT>
<DD>Reads at most <FONT SIZE="-1">SIZE</FONT> bytes of the contents of shared
memory segment <FONT SIZE="-1">ID</FONT> starting at offset <FONT SIZE="-1">POS</FONT> into <FONT SIZE="-1">VAR</FONT>.
<DT><B>shmwrite</B> <FONT SIZE="-1">ID</FONT><TT><B>,</B></TT> <FONT SIZE="-1">STRING</FONT><TT><B>,</B></TT> <FONT SIZE="-1">POS</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SIZE</FONT>
<DD>Writes at most <FONT SIZE="-1">SIZE</FONT> bytes of <FONT SIZE="-1">STRING</FONT> into the contents of
shared memory segment <FONT SIZE="-1">ID</FONT> at offset <FONT SIZE="-1">POS</FONT>.
</DL>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="miscellaneous"></A>
<H2>Miscellaneous</H2>
<DL>
<DT><B>defined</B> <FONT SIZE="-1">EXPR</FONT>
<DD>Tests whether the lvalue <FONT SIZE="-1">EXPR</FONT> has an actual value.
<DT><B>do</B> <FONT SIZE="-1">FILENAME</FONT>
<DD>Executes <FONT SIZE="-1">FILENAME</FONT> as a Perl script.
See also <B>require</B> in the section
<A HREF="#subroutines">Subroutines, Packages and Modules</A>.
<DT><B>dump</B> [ <FONT SIZE="-1">LABEL</FONT> ]
<DD>Immediate core dump.
When reincarnated, starts at <FONT SIZE="-1">LABEL</FONT>.
<DT><B>eval</B> <TT><B>{</TT></B> <FONT SIZE="-1">EXPR</FONT> <TT><B>;</TT></B> ... <TT><B>}</TT></B>
<DD>Executes the code between <TT><B>{</TT></B> and <TT><B>}</TT></B>.
Traps runtime errors as described
with <B>eval</B><TT><B>(</TT></B><FONT SIZE="-1">EXPR</FONT><TT><B>)</TT></B>, in the section <A HREF="#string">String Functions</A>.
<DT><B>local</B> <FONT SIZE="-1">VARIABLE</FONT>
<DT><B>local</B> <TT><B>(</TT></B> <FONT SIZE="-1">LIST</FONT> <TT><B>)</TT></B>
<DD>Creates a scope for the listed variables local to the enclosing block,
subroutine or <B>eval</B>.
<DT><B>my</B> <FONT SIZE="-1">VARIABLE</FONT>
<DT><B>my</B> <TT><B>(</TT></B> <FONT SIZE="-1">LIST</FONT> <TT><B>)</TT></B>
<DD>Creates a scope for the listed variables lexically local to the enclosing block,
subroutine or <B>eval</B>.
<DT><B>ref</B> <FONT SIZE="-1">EXPR&#134;</FONT>
<DD>Returns a <B>true</B> value if <FONT SIZE="-1">EXPR</FONT> is a reference.
Returns the package name if <FONT SIZE="-1">EXPR</FONT> has been blessed into a package.
<DT><B>reset</B> [ <FONT SIZE="-1">EXPR</FONT> ]
<DD>Resets <TT><B>??</B></TT> searches so that they work again.
<FONT SIZE="-1">EXPR</FONT> is a list of single letters. All variables and arrays
beginning with one of those letters are reset
to their pristine state. Only affects the current package.
<DT><B>scalar</B> <FONT SIZE="-1">EXPR</FONT>
<DD>Forces evaluation of <FONT SIZE="-1">EXPR</FONT> in scalar context.
<DT><B>undef</B> [ <FONT SIZE="-1">LVALUE</FONT> ]
<DD>Undefines the <FONT SIZE="-1">LVALUE</FONT>. Always returns the undefined value.
<DT><B>wantarray</B>
<DD>Returns <B>true</B> if the current context expects an array value.
</DL>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="information"></A>
<H2>Information from System Files</H2>
<TABLE CELLSPACING=0 CELLPADDING=0>
<TR>
<TD COLSPAN=2><LI><FONT SIZE="+1"><B>passwd</B></FONT></TD>
</TR>
<TR>
<TD COLSPAN=2>Returns <TT><B>($</B></TT>name, <TT><B>$</B></TT>passwd,
<TT><B>$</B></TT>uid, <TT><B>$</B></TT>gid, <TT><B>$</B></TT>quota,
<TT><B>$</B></TT>comment, <TT><B>$</B></TT>gcos, <TT><B>$</B></TT>dir,
<TT><B>$</B></TT>shell<TT><B>)</TT></B>.</TD>
</TR>
<TR>
<TD><B>endpwent</B></TD>
<TD>Ends lookup processing.</TD>
</TR>
<TR>
<TD><B>getpwend</B></TD>
<TD>Gets next user information.</TD>
</TR>
<TR>
<TD><B>getpwnam</B> <FONT SIZE="-1">NAME</FONT></TD>
<TD>Gets information by name.</TD>
</TR>
<TR>
<TD><B>getpwuid</B> <FONT SIZE="-1">UID</FONT></TD>
<TD>Gets information by user ID.</TD>
</TR>
<TR>
<TD><B>setpwent</B></TD>
<TD>Resets lookup processing.</TD>
</TR>
<TR><TD COLSPAN=2>&nbsp;</TD></TR>
<TR>
<TD COLSPAN=2><LI><FONT SIZE="+1"><B>group</B></FONT></TD>
</TR>
<TR>
<TD COLSPAN=2>Returns <TT><B>($</B></TT>name, <TT><B>$</B></TT>passwd,
<TT><B>$</B></TT>gid, <TT><B>$</B></TT>members<TT><B>)</TT></B>.</TD>
</TR>
<TR>
<TD><B>endgrent</B></TD>
<TD>Ends lookup processing.</TD>
</TR>
<TR>
<TD><B>getgrgid</B> <FONT SIZE="-1">GID</FONT></TD>
<TD>Gets information by group ID.</TD>
</TR>
<TR>
<TD><B>getgrnam</B> <FONT SIZE="-1">NAME</FONT></TD>
<TD>Gets information by name.</TD>
</TR>
<TR>
<TD><B>getgrent</B></TD>
<TD>Gets next information.</TD>
</TR>
<TR>
<TD><B>setgrent</B></TD>
<TD>Resets lookup processing.</TD>
</TR>
<TR><TD COLSPAN=2>&nbsp;</TD></TR>
<TR>
<TD COLSPAN=2><LI><FONT SIZE="+1"><B>hosts</B></FONT></TD>
</TR>
<TR>
<TD COLSPAN=2>Returns <TT><B>($</B></TT>name, <TT><B>$</B></TT>aliases,
<TT><B>$</B></TT>addrtype, <TT><B>$</B></TT>length, <TT><B>@</B></TT>addrs<TT><B>)</TT></B>.</TD>
</TR>
<TR>
<TD><B>endhostent</B></TD>
<TD>Ends lookup processing.</TD>
</TR>
<TR>
<TD><B>gethostbyaddr</B> <FONT SIZE="-1">ADDR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">ADDRTYPE</FONT></TD>
<TD>Gets information by IP address.</TD>
</TR>
<TR>
<TD><B>gethostbyname</B> <FONT SIZE="-1">NAME</FONT></TD>
<TD>Gets information by hostname.</TD>
</TR>
<TR>
<TD><B>gethostent</B></TD>
<TD>Gets next host information.</TD>
</TR>
<TR>
<TD><B>sethostent</B> <FONT SIZE="-1">STAYOPEN</FONT></TD>
<TD>Resets lookup processing.</TD>
</TR>
<TR><TD COLSPAN=2>&nbsp;</TD></TR>
<TR>
<TD COLSPAN=2><LI><FONT SIZE="+1"><B>networks</B></FONT></TD>
</TR>
<TR>
<TD COLSPAN=2>Returns <TT><B>($</B></TT>name, <TT><B>$</B></TT>aliases,
<TT><B>$</B></TT>addrtype, <TT><B>$</B></TT>net<TT><B>)</TT></B>.</TD>
</TR>
<TR>
<TD><B>endnetent</B></TD>
<TD>Ends lookup processing.</TD>
</TR>
<TR>
<TD><B>getnetbyaddr</B> <FONT SIZE="-1">ADDR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">TYPE</FONT></TD>
<TD>Gets information by address and type.</TD>
</TR>
<TR>
<TD><B>getnetbyname</B> <FONT SIZE="-1">NAME</FONT></TD>
<TD>Gets information by network name.</TD>
</TR>
<TR>
<TD><B>getnetent</B></TD>
<TD>Gets next network information.</TD>
</TR>
<TR>
<TD><B>setnetent</B> <FONT SIZE="-1">STAYOPEN</FONT></TD>
<TD>Resets lookup processing.</TD>
</TR>
<TR><TD COLSPAN=2>&nbsp;</TD></TR>
<TR>
<TD COLSPAN=2><LI><FONT SIZE="+1"><B>services</B></FONT></TD>
</TR>
<TR>
<TD COLSPAN=2>Returns <TT><B>($</B></TT>name, <TT><B>$</B></TT>aliases,
<TT><B>$</B></TT>port, <TT><B>$</B></TT>proto<TT><B>)</TT></B>.</TD>
</TR>
<TR>
<TD><B>endservent</B></TD>
<TD>Ends lookup processing.</TD>
</TR>
<TR>
<TD><B>getservbyname</B> <FONT SIZE="-1">NAME</FONT><TT><B>,</B></TT> <FONT SIZE="-1">PROTO</FONT></TD>
<TD>Gets information by service name.</TD>
</TR>
<TR>
<TD><B>getservbyport</B> <FONT SIZE="-1">PORT</FONT><TT><B>,</B></TT> <FONT SIZE="-1">PROTO</FONT></TD>
<TD>Gets information by service port.</TD>
</TR>
<TR>
<TD><B>getservent</B></TD>
<TD>Gets next service information.</TD>
</TR>
<TR>
<TD><B>setservent</B> <FONT SIZE="-1">STAYOPEN</FONT></TD>
<TD>Resets lookup processing.</TD>
</TR>
<TR><TD COLSPAN=2>&nbsp;</TD></TR>
<TR>
<TD COLSPAN=2><LI><FONT SIZE="+1"><B>protocols</B></FONT></TD>
</TR>
<TR>
<TD COLSPAN=2>Returns <TT><B>($</B></TT>name, <TT><B>$</B></TT>aliases,
<TT><B>$</B></TT>proto<TT><B>)</TT></B>.</TD>
</TR>
<TR>
<TD><B>endprotoent</B></TD>
<TD>Ends lookup processing.</TD>
</TR>
<TR>
<TD><B>getprotobyname</B> <FONT SIZE="-1">NAME</FONT></TD>
<TD>Gets information by protocol name.</TD>
</TR>
<TR>
<TD><B>getprotobynumber</B> <FONT SIZE="-1">NUMBER</FONT></TD>
<TD>Gets information by protocol number.</TD>
</TR>
<TR>
<TD><B>getprotoent</B></TD>
<TD>Gets next protocol information.</TD>
</TR>
<TR>
<TD><B>setprotoent</B> <FONT SIZE="-1">STAYOPEN</FONT></TD>
<TD>Resets lookup processing.</TD>
</TR>
</TABLE>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="specialvariables"></A>
<H2>Special Variables</H2>
<TABLE CELLSPACING=0 CELLPADDING=0>
<TR><TD VALIGN=top COLSPAN=2>The following variables are global and should be
localized in subroutines:</TD></TR>
<TR><TD VALIGN=top><TT><B>$_</B></TT></TD>
<TD VALIGN=top>The default input and pattern-searching space.</TD></TR>
<TR><TD VALIGN=top><TT><B>$.</B></TT></TD>
<TD VALIGN=top>The current input line number of the last filehandle that was read.</TD></TR>
<TR><TD VALIGN=top><TT><B>$/</B></TT></TD>
<TD VALIGN=top>The input record separator, newline by default. May be multicharacter.</TD></TR>
<TR><TD VALIGN=top><TT><B>$,</B></TT></TD>
<TD VALIGN=top>The output field separator for the print operator.</TD></TR>
<TR><TD VALIGN=top><TT><B>$"</B></TT></TD>
<TD VALIGN=top>The separator that joins elements of arrays interpolated in strings.</TD></TR>
<TR><TD VALIGN=top><TT><B>$\</B></TT></TD>
<TD VALIGN=top>The output record separator for the print operator.</TD></TR>
<TR><TD VALIGN=top><TT><B>$#</B></TT></TD>
<TD VALIGN=top>The output format for printed numbers. Depreciated.</TD></TR>
<TR><TD VALIGN=top><TT><B>$*</B></TT></TD>
<TD VALIGN=top>Set to 1 to do multiline matching within strings.
Deprecated, see the <B>m</B> and <B>s</B> modifiers in section
<A HREF="#search">Search and Replace Functions</A>.</TD></TR>
<TR><TD VALIGN=top><TT><B>$?</B></TT></TD>
<TD VALIGN=top>The status returned by the last <TT><B>`</B></TT>...<TT><B>`</B></TT> command,
pipe <B>close</B> or <B>system</B> operator.</TD></TR>
<TR><TD VALIGN=top><TT><B>$]</B></TT></TD>
<TD VALIGN=top>The perl version number, e.g., <TT><B>5.001</TT></B>.</TD></TR>
<TR><TD VALIGN=top><TT><B>$[</B></TT></TD>
<TD VALIGN=top>The index of the first element in an array, and of the first character
in a substring. Default is 0. Depreciated.</TD></TR>
<TR><TD VALIGN=top><TT><B>$;</B></TT></TD>
<TD VALIGN=top>The subscript separator for multidimensional array emulation.
Default is "<TT><B>\034</B></TT>".</TD></TR>
<TR><TD VALIGN=top><TT><B>$!</B></TT></TD>
<TD VALIGN=top>If used in a numeric context, yields the current value of <B>errno</B>.
If used in a string context, yields the corresponding error string.</TD></TR>
<TR><TD VALIGN=top><TT><B>$@</B></TT></TD>
<TD VALIGN=top>The Perl error message from the last <B>eval</B> or <B>do</B> <FONT SIZE="-1">EXPR</FONT>
command.</TD></TR>
<TR><TD VALIGN=top><TT><B>$:</B></TT></TD>
<TD VALIGN=top>The set of characters after which a string may be broken to
fill continuation fields (starting with <TT><B>^</B></TT>) in a format.</TD></TR>
<TR><TD VALIGN=top><TT><B>$0</B></TT></TD>
<TD VALIGN=top>The name of the file containing the Perl script being executed.
May be assigned to.</TD></TR>
<TR><TD VALIGN=top><TT><B>$$</B></TT></TD>
<TD VALIGN=top>The process ID of the currently executing Perl program.
Altered (in the child process) by <B>fork</B>.</TD></TR>
<TR><TD VALIGN=top><TT><B>$&lt;</B></TT></TD>
<TD VALIGN=top>The real user ID of this process.</TD></TR>
<TR><TD VALIGN=top><TT><B>$&gt;</B></TT></TD>
<TD VALIGN=top>The effective user ID of this process.</TD></TR>
<TR><TD VALIGN=top><TT><B>$(</B></TT></TD>
<TD VALIGN=top>The real group ID of this process.</TD></TR>
<TR><TD VALIGN=top><TT><B>$)</B></TT></TD>
<TD VALIGN=top>The effective group ID of this process.</TD></TR>
<TR><TD VALIGN=top><TT><B>$^A</B></TT></TD>
<TD VALIGN=top>The accumulator for <B>formline</B> and <B>write</B> operations.</TD></TR>
<TR><TD VALIGN=top><TT><B>$^D</B></TT></TD>
<TD VALIGN=top>The debug flags as passed to perl using <TT><B>-D</B></TT>.</TD></TR>
<TR><TD VALIGN=top><TT><B>$^F</B></TT></TD>
<TD VALIGN=top>The highest system file descriptor, ordinarily 2.</TD></TR>
<TR><TD VALIGN=top><TT><B>$^I</B></TT></TD>
<TD VALIGN=top>In-place edit extension as passed to Perl using <TT><B>-i</B></TT>.</TD></TR>
<TR><TD VALIGN=top><TT><B>$^L</B></TT></TD>
<TD VALIGN=top>Formfeed character used in formats.</TD></TR>
<TR><TD VALIGN=top><TT><B>$^P</B></TT></TD>
<TD VALIGN=top>Internal debugging flag.</TD></TR>
<TR><TD VALIGN=top><TT><B>$^T</B></TT></TD>
<TD VALIGN=top>The time (as delivered by <B>time</B>) when the program started.
This value is used by the file test operators <TT><B>-M</B></TT>,
<TT><B>-A</B></TT> and <TT><B>-C</B></TT>.</TD></TR>
<TR><TD VALIGN=top><TT><B>$^W</B></TT></TD>
<TD VALIGN=top>The value if the <TT><B>-w</B></TT> option as passed to Perl.</TD></TR>
<TR><TD VALIGN=top><TT><B>$^X</B></TT></TD>
<TD VALIGN=top>The name by which the currently executing program was invoked.</TD></TR>
<TR><TD COLSPAN=2>&nbsp;</TD></TR>
<TR><TD VALIGN=top COLSPAN=2>The following variables are context dependent
and need not be localized:</TD></TR>
<TR><TD VALIGN=top><TT><B>$%</B></TT></TD>
<TD VALIGN=top>The current page number of the currently selected output channel.</TD></TR>
<TR><TD VALIGN=top><TT><B>$=</B></TT></TD>
<TD VALIGN=top>The page length of the current output channel. Default is 60 lines.</TD></TR>
<TR><TD VALIGN=top><TT><B>$-</B></TT></TD>
<TD VALIGN=top>The number of lines remaining on the page.</TD></TR>
<TR><TD VALIGN=top><TT><B>$~</B></TT></TD>
<TD VALIGN=top>The name of the current report format.</TD></TR>
<TR><TD VALIGN=top><TT><B>$^</B></TT></TD>
<TD VALIGN=top>The name of the current top-of-page format.</TD></TR>
<TR><TD VALIGN=top><TT><B>$|</B></TT></TD>
<TD VALIGN=top>If set to nonzero, forces a flush after every write or print on the
currently selected output channel. Default is 0.</TD></TR>
<TR><TD VALIGN=top><TT><B>$ARGV</B></TT></TD>
<TD VALIGN=top>The name of the current file when reading from <TT><B>&lt;&gt;</B></TT>.</TD></TR>
<TR><TD COLSPAN=2>&nbsp;</TD></TR>
<TR><TD VALIGN=top COLSPAN=2>The following variables are always local to the
current block:</TD></TR>
<TR><TD VALIGN=top><TT><B>$&amp;</B></TT></TD>
<TD VALIGN=top>The string matched by the last successful pattern match.</TD></TR>
<TR><TD VALIGN=top><TT><B>$`</B></TT></TD>
<TD VALIGN=top>The string preceding what was matched by the last successful match.</TD></TR>
<TR><TD VALIGN=top><TT><B>$'</B></TT></TD>
<TD VALIGN=top>The string following what was matched by the last successful match.</TD></TR>
<TR><TD VALIGN=top><TT><B>$+</B></TT></TD>
<TD VALIGN=top>The last bracket matched by the last search pattern.</TD></TR>
<TR><TD VALIGN=top><TT><B>$1</B></TT>...<TT><B>$9</B></TT>...&nbsp;&nbsp;</TD>
<TD VALIGN=top>Contain the subpatterns from the corresponding sets of parentheses in the
last pattern successfully matched. <TT><B>$10</B></TT>... and up are only available if the
match contained that many subpatterns.</TD></TR>
</TABLE>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="specialarrays"></A>
<H2>Special Arrays</H2>
<TABLE CELLSPACING=0 CELLPADDING=0>
<TR><TD VALIGN=top><TT><B>@ARGV</B></TT></TD>
<TD VALIGN=top>Contains the command-line arguments for the script (not including the
command name).</TD></TR>
<TR><TD VALIGN=top><TT><B>@EXPORT</B></TT></TD>
<TD VALIGN=top>Names the methods a package exports by default.</TD></TR>
<TR><TD VALIGN=top><TT><B>@EXPORT_OK&nbsp;</B></TT></TD>
<TD VALIGN=top>Names the methods a package can export upon explicit request.</TD></TR>
<TR><TD VALIGN=top><TT><B>@INC</B></TT></TD>
<TD VALIGN=top>Contains the list of places to look for Perl scripts to be evaluated by
the <B>do</B> <FONT SIZE="-1">FILENAME</FONT> and <B>require</B> commands.</TD></TR>
<TR><TD VALIGN=top><TT><B>@ISA</B></TT></TD>
<TD VALIGN=top>List of base classes of a package.</TD></TR>
<TR><TD VALIGN=top><TT><B>@_</B></TT></TD>
<TD VALIGN=top>Parameter array for subroutines. Also used by <B>split</B>
if not in array context.</TD></TR>
<TR><TD VALIGN=top><TT><B>%ENV</B></TT></TD>
<TD VALIGN=top>Contains the current environment.</TD></TR>
<TR><TD VALIGN=top><TT><B>%INC</B></TT></TD>
<TD VALIGN=top>List of files that have been included with <B>require</B> or <B>do</B>.</TD></TR>
<TR><TD VALIGN=top><TT><B>%OVERLOAD</B></TT></TD>
<TD VALIGN=top>Can be used to overload operators in a package.</TD></TR>
<TR><TD VALIGN=top><TT><B>%SIG</B></TT></TD>
<TD VALIGN=top>Used to set signal handlers for various signals.</TD></TR>
</TABLE>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="environment"></A>
<H2>Environment Variables</H2>
<P>Perl uses the following environment variables.</P>
<TABLE CELLSPACING=0 CELLPADDING=0>
<TR><TD VALIGN=top><TT><B>HOME</B></TT></TD>
<TD VALIGN=top>Used if <B>chdir</B> has no argument.</TD></TR>
<TR><TD VALIGN=top><TT><B>LOGDIR</B></TT></TD>
<TD VALIGN=top>Used if <B>chdir</B> has no argument and <TT><B>HOME</TT></B> is not set.</TD></TR>
<TR><TD VALIGN=top><TT><B>PATH</B></TT></TD>
<TD VALIGN=top>Used in executing subprocesses, and in finding the Perl script if <TT><B>-S</TT></B>
is used.</TD></TR>
<TR><TD VALIGN=top><TT><B>PERL5LIB&nbsp;</B></TT></TD>
<TD VALIGN=top>A colon-separated list of directories to look in for Perl library files
before looking in the standard library and the current directory.</TD></TR>
<TR><TD VALIGN=top><TT><B>PERL5DB</B></TT></TD>
<TD VALIGN=top>The command to get the debugger code.
<BR>Defaults to <TT><B>BEGIN { require 'perl5db.pl' }</TT></B>.</TD></TR>
<TR><TD VALIGN=top><TT><B>PERLLIB</B></TT></TD>
<TD VALIGN=top>Used instead of <TT><B>PERL5LIB</TT></B> if the latter is not defined.</TD></TR>
</TABLE>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<A NAME="debugger"></A>
<H2>The Perl Debugger</H2>
The Perl symbolic debugger is invoked with <TT><B>perl -d</B></TT>.
<TABLE CELLSPACING=0 CELLPADDING=0>
<TR><TD VALIGN=top><TT><B>h</B></TT></TD>
<TD VALIGN=top>Prints out a help message.</TD></TR>
<TR><TD VALIGN=top><TT><B>T</B></TT></TD>
<TD VALIGN=top>Prints a stack trace.</TD></TR>
<TR><TD VALIGN=top><TT><B>s</B></TT></TD>
<TD VALIGN=top>Single steps.</TD></TR>
<TR><TD VALIGN=top><TT><B>n</B></TT></TD>
<TD VALIGN=top>Single steps around subroutine call.</TD></TR>
<TR><TD VALIGN=top><FONT SIZE="-1">RETURN key</FONT></TD>
<TD VALIGN=top>Repeats last <TT><B>s</B></TT> or <TT><B>n</B></TT>.</TD></TR>
<TR><TD VALIGN=top><TT><B>r</B></TT></TD>
<TD VALIGN=top>Returns form the current subroutine.</TD></TR>
<TR><TD VALIGN=top><TT><B>c</B></TT> [ <FONT SIZE="-1">LINE</FONT> ]</TD>
<TD VALIGN=top>Continues (until <FONT SIZE="-1">LINE</FONT>,
or another breakpoint, or exit).</TD></TR>
<TR><TD VALIGN=top><TT><B>p</B></TT> <FONT SIZE="-1">EXPR</FONT></TD>
<TD VALIGN=top>Prints <FONT SIZE="-1">EXPR</FONT>.</TD></TR>
<TR><TD VALIGN=top><TT><B>l</B></TT> [ <FONT SIZE="-1">RANGE</FONT> ]</TD>
<TD VALIGN=top>Lists a range of lines.
<FONT SIZE="-1">RANGE</FONT> may be a number, start-end,
start+amount, or a subroutine name. If <FONT SIZE="-1">RANGE</FONT> is omitted,
lists next window.</TD></TR>
<TR><TD VALIGN=top><TT><B>w</B></TT></TD>
<TD VALIGN=top>Lists window around current line.</TD></TR>
<TR><TD VALIGN=top><TT><B>-</B></TT></TD>
<TD VALIGN=top>Lists previous window.</TD></TR>
<TR><TD VALIGN=top><TT><B>f</B></TT> <FONT SIZE="-1">FILE</FONT></TD>
<TD VALIGN=top>Switches to <FONT SIZE="-1">FILE</FONT> and starts listing it.</TD></TR>
<TR><TD VALIGN=top><TT><B>l</B></TT> <FONT SIZE="-1">SUB</FONT></TD>
<TD VALIGN=top>Lists the named subroutine.</TD></TR>
<TR><TD VALIGN=top><TT><B>S</B></TT></TD>
<TD VALIGN=top>List the names of all subroutines.</TD></TR>
<TR><TD VALIGN=top><TT><B>/</B></TT><FONT SIZE="-1">PATTERN</FONT><TT><B>/</B></TT></TD>
<TD VALIGN=top>Searches forward for <FONT SIZE="-1">PATTERN</FONT>.</TD></TR>
<TR><TD VALIGN=top><TT><B>?</B></TT><FONT SIZE="-1">PATTERN</FONT><TT><B>?</B></TT></TD>
<TD VALIGN=top>Searches backward for <FONT SIZE="-1">PATTERN</FONT>.</TD></TR>
<TR><TD VALIGN=top NOWRAP><TT><B>b</B></TT> [ <FONT SIZE="-1">LINE</FONT> [ <FONT SIZE="-1">CONDITION</FONT> ] ]&nbsp;&nbsp;</TD>
<TD VALIGN=top>Sets breakpoint at <FONT SIZE="-1">LINE</FONT>; default is the current line.</TD></TR>
<TR><TD VALIGN=top><TT><B>b</B></TT> <FONT SIZE="-1">SUB</FONT> [ <FONT SIZE="-1">CONDITION</FONT> ]</TD>
<TD VALIGN=top>Sets breakpoint at the subroutine.</TD></TR>
<TR><TD VALIGN=top><TT><B>d</B></TT> [ <FONT SIZE="-1">LINE</FONT> ]</TD>
<TD VALIGN=top>Deletes breakpoint at the given line.</TD></TR>
<TR><TD VALIGN=top><TT><B>D</B></TT></TD>
<TD VALIGN=top>Deletes all breakpoints.</TD></TR>
<TR><TD VALIGN=top><TT><B>L</B></TT></TD>
<TD VALIGN=top>Lists lines that have breakpoints or actions.</TD></TR>
<TR><TD VALIGN=top><TT><B>a</B></TT> <FONT SIZE="-1">LINE COMMAND</FONT></TD>
<TD VALIGN=top>Sets an action for line.</TD></TR>
<TR><TD VALIGN=top><TT><B>A</B></TT></TD>
<TD VALIGN=top>Deletes all line actions.</TD></TR>
<TR><TD VALIGN=top><TT><B>&lt;</B></TT> <FONT SIZE="-1">COMMAND</FONT></TD>
<TD VALIGN=top>Sets an action to be executed before every debugger prompt.</TD></TR>
<TR><TD VALIGN=top><TT><B>&gt;</B></TT> <FONT SIZE="-1">COMMAND</FONT></TD>
<TD VALIGN=top>Sets an action to be executed before every
<TT><B>s</B></TT>, <TT><B>c</B></TT> or <TT><B>n</B></TT> command.</TD></TR>
<TR><TD VALIGN=top NOWRAP><TT><B>V</B></TT> [ <FONT SIZE="-1">PACKAGE</FONT> [ <FONT SIZE="-1">VARS</FONT> ] ]&nbsp;&nbsp;</TD>
<TD VALIGN=top>Lists all variables in a package. Default package is <TT><B>main</TT></B>.</TD></TR>
<TR><TD VALIGN=top><TT><B>X</B></TT> [ <FONT SIZE="-1">VARS</FONT> ]</TD>
<TD VALIGN=top>Like <TT><B>V</B></TT>, but assumes current package.</TD></TR>
<TR><TD VALIGN=top><TT><B>!</B></TT> [ [<TT><B>-</TT></B>]<FONT SIZE="-1">NUMBER</FONT> ]</TD>
<TD VALIGN=top>Re-executes a command. Default is the previous command.</TD></TR>
<TR><TD VALIGN=top><TT><B>H</B></TT> [ -<FONT SIZE="-1">NUMBER</FONT> ]</TD>
<TD VALIGN=top>Displays the last <TT><B>-</TT></B><FONT SIZE="-1">NUMBER</FONT>
commands of more than one letter.</TD></TR>
<TR><TD VALIGN=top><TT><B>t</B></TT></TD>
<TD VALIGN=top>Toggles trace mode.</TD></TR>
<TR><TD VALIGN=top><TT><B>=</B></TT> [ <FONT SIZE="-1">ALIAS VALUE</FONT> ]</TD>
<TD VALIGN=top>Sets alias, or lists current aliases.</TD></TR>
<TR><TD VALIGN=top><TT><B>q</B></TT></TD>
<TD VALIGN=top>Quits. You may also use your <FONT SIZE="-1">EOF key</FONT> character.</TD></TR>
<TR><TD VALIGN=top><FONT SIZE="-1">COMMAND</FONT></TD>
<TD VALIGN=top>Executes <FONT SIZE="-1">COMMAND</FONT> as a Perl statement.</TD></TR>
</TABLE>
<H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
<!-- ----------------------------------------------------------------------------- -->
<HR NOSHADE SIZE=4>
<H3>Other Summaries and Demos</H3>
<UL>
<LI>See my <A HREF="http://www.pcnet.com/~rhswain/">home page</A> for other summaries and demos:
APL, REXX, XEDIT, Perl, HTML, RGB Colors, HTTP Cookies, Email Forms,
CGI Environment Variables, Server Side Includes, etc...
</UL>
<HR SIZE=1>
<CENTER>
<ADDRESS>
Text copyright &copy; 1996 Johan Vromans<BR>
HTML copyright &copy; 1996-1997 Rex Swain<BR>
Email <A HREF="mailto:[email protected]">[email protected]</A>,
Web <A HREF="http://www.pcnet.com/~rhswain/">http://www.pcnet.com/~rhswain</A><BR>
Permission granted to distribute unmodified copies<BR>
Reports of errors or omissions appreciated
</ADDRESS>
</CENTER>
</BODY>
</HTML>