home *** CD-ROM | disk | FTP | other *** search
- From: jv@mh.nl (Johan Vromans)
- Newsgroups: comp.lang.perl,alt.sources
- Subject: TeX version of the Perl Reference Guide - part 1 of 2
- Message-ID: <JV.90Jun13103754@squirrel.mh.nl>
- Date: 13 Jun 90 16:37:54 GMT
- X-Checksum-Snefru: 9884ed9e ac92ddd9 df9a63ad 87bbe6c6
-
- This is a TeX version of the information on the Perl Reference Guide,
- based on guide version 3.0.18.2. It will create a printable copy of
- the information on the Guide, but not its fancy formatting.
-
- NOTE: This TeX document has been created by Raymond Chen
- <raymond@math.berkeley.edu>. You should contact him for details
- and remarks. I'm only passing it through.
-
- Submitted-by: Raymond Chen <raymond@math.berkeley.edu>
- Archive-name: perlref.tex/part01
-
- ---- Cut Here and unpack ----
- #!/bin/sh
- # This is perlref.tex, a shell archive (shar 3.24)
- # made 06/13/1990 08:34 UTC by jv@squirrel
- # Source directory /u/jv/perlref/TeX
- #
- # existing files WILL be overwritten
- #
- # This is part 1 of a multipart archive
- # do not concatenate these parts, unpack them in order with /bin/sh
- #
- # This shar contains:
- # length mode name
- # ------ ---------- ------------------------------------------
- # 37522 -rw-r--r-- perlref.tex
- #
- if touch 2>&1 | fgrep '[-amc]' > /dev/null
- then TOUCH=touch
- else TOUCH=true
- fi
- if test -r shar3_seq_.tmp; then
- echo "Must unpack archives in sequence!"
- next=`cat shar3_seq_.tmp`; echo "Please unpack part $next next"
- exit 1
- fi
- # ============= perlref.tex ==============
- echo "x - extracting perlref.tex (Text)"
- sed 's/^X//' << 'SHAR_EOF' > perlref.tex &&
- X% Perl Reference Guide (for perl version 3.0)
- X%
- X% Perl designed and created by Larry Wall <lwall@jpl-devvax.jpl.nasa.gov>
- X% Reference guide designed and created by Johan Vromans <jv@mh.nl>
- X% TeX version by Raymond Chen <raymond@math.berkeley.edu>
- X%
- X% Copyright 1989, 1990 Johan Vromans
- X% TeX version Copyright 1990 Raymond Chen
- X%
- X% Rev. 3.0.18.1 Use and reproduction of this information is unlimited.
- X%
- X% Changes to Johan's wording are marked by %%rjc%%
- X%
- X%%%%%%%%%% This file uses one nonstandard font for the title page.
- X% If you don't have it, then change the following \iffalse to \iftrue.
- X\iffalse
- X \let\twelvebf=\bf
- X\else
- X \font\twelvebf=cmbx12
- X\fi
- X%%%%%%%%%% You may steal the following magic macros.
- X%
- X% Magic:
- X%
- X% |stuff| puts the stuff in \tt.
- X% <stuff> puts the stuff in \it.
- X
- X%% verbatim macros
- X\chardef\other=12
- X\def\ttverbatim{\begingroup \catcode`\\=\other \catcode`\{=\other
- X\catcode`\}=\other \catcode`\$=\other \catcode`\&=\other
- X\catcode`\#=\other \catcode`\%=\other \catcode`\~=\other
- X\catcode`\_=\other \catcode`\^=\other \catcode`\<=\other
- X\obeyspaces \obeylines \tt}
- X
- X{\catcode`\|=\active
- X\obeylines \gdef|{\leavevmode%
- X \ttverbatim \spaceskip.5em plus.25em minus.15em%
- X \let^^M=\ \let|=\endgroup \escapechar`\|}}
- X
- X\catcode`\|=\active
- X\def\|{\leavevmode\hbox{\tt\char`\|}}
- X
- X\catcode`\<=\active
- X\def<{\leavevmode\italicizerest}
- X\def\italicizerest#1>{{\it#1\/}}
- X
- X\def\cstok#1{\leavevmode\thinspace\hbox{\vrule\vtop{\vbox{\hrule\kern1pt%
- X \hbox{\vphantom{\tt/}\thinspace{\tt#1}\thinspace}}%
- X \kern1pt\hrule}\vrule}\thinspace}
- X
- X\catcode`\&=\active
- X\let&=\undefined
- X
- X\def\*{$^\dagger$}
- X
- X\newdimen\tablewidth
- X\def\table{\everypar={\nextitem}\parindent=0pt\tablewidth}
- X\def\endtable{\everypar={}\par}
- X
- X\def\outtext{\everypar={\hangindent=3pc\relax}\parindent0pt\relax}
- X\def\text{\everypar={}\parindent0pt\relax}
- X
- X\def\nextitem{\bgroup\let\par\means\obeylines\global\setbox0=\hbox\bgroup}
- X\def\means{\enskip\egroup\egroup
- X \ifdim\wd0>\tablewidth
- X \hangindent\tablewidth
- X \box0\hfill\break
- X \hskip\tablewidth
- X \else\hangindent\tablewidth
- X \hbox to\tablewidth{\box0\hss}%
- X \fi\ignorespaces}
- X
- X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- X
- X\centerline{\twelvebf Perl Reference Guide}
- X\centerline{\bf for perl version 3.0}
- X\medskip
- X\hbox to \hsize{\hss
- X Perl program designed and
- X created by Larry Wall |<lwall@jpl-devvax.jpl.nasa.gov>|\hss}
- X\hbox to \hsize{\hss
- X Reference guide designed and created by Johan Vromans |<jv@mh.nl>|\hss}
- X\hbox to \hsize{\hss
- X \TeX\ version by Raymond Chen |<raymond@math.berkeley.edu>|\hss}
- X\medskip
- X\centerline{Copyright \copyright 1989, 1990 Johan Vromans}
- X\centerline{\TeX\ version Copyright 1990 Raymond Chen}
- X\centerline{Rev. 3.0.18.1}
- X\centerline{Use and reproduction of this information is unlimited.}
- X\bigskip
- X
- X\centerline{\bf Contents}
- X\bigskip
- X\line{\hss\catcode`\?=\active \let?=\space
- X\def\<#1. #2.{\hbox{#1\quad#2}}
- X\vbox{
- X\<?1. Command line options.
- X\<?2. Literals.
- X\<?3. Variables.
- X\<?4. Statements.
- X\<?5. Flow control.
- X\<?6. Operators.
- X\<?7. File test operators.
- X\<?8. Arithmetic functions.
- X\<?9. Conversion functions.
- X\<10. Structure conversion.
- X\<11. String functions.
- X\<12. Array and list functions.
- X}\qquad\vbox{
- X\<13. File operations.
- X\<14. Directory reading routines.
- X\<15. Input/Output.
- X\<16. Search and replace functions.
- X\<17. System interaction.
- X\<18. Networking.
- X\<19. Miscellaneous.
- X\<20. Info from system files.
- X\<21. Regular expressions.
- X\<22. Formats.
- X\<23. Special variables.
- X\<24. Special arrays.
- X}\hss}
- X
- X\beginsection 1. Command line options
- X
- X\table1.2in
- X
- X|-a|
- Xturns on autosplit mode when used with |-n| or |-p|. Splits to |@F|.
- X
- X|-d|
- Xruns the script under the debugger. Use ``|-de 0|'' to start the
- Xdebugger without a script.
- X
- X|-D|<number>
- Xsets debugging flags.
- X
- X|-e| <commandline>
- X may be used to enter one line of script. Multiple
- X |-e| commands may be given to build up a multi-line script.
- X
- X|-i|<extension>
- X specifies that files processed by
- X the |<>| construct are to be edited in-place.
- X
- X|-I|<directory>
- X with |-P|: tells the C preprocessor where to look
- X for include files.
- X
- X|-n|
- Xassumes an input loop around your script. Lines are not printed.
- X
- X|-p|
- Xassumes an input loop around your script. Lines are printed.
- X
- X|-P|
- Xruns the C preprocessor on the script before compilation by perl.
- X
- X|-s|
- X interprets ``|-xxx|'' on the command line as switches and sets the
- X corresponding variables |$xxx| in the script.
- X
- X|-S|
- Xuses the |PATH| environment variable to search for the script.
- X
- X|-u|
- Xdumps core after compiling the script.
- X
- X|-U|
- Xallows perl to do unsafe operations.
- X
- X|-v|
- Xprints the version and patchlevel of your perl executable.
- X
- X|-w|
- X prints warnings about possible spelling errors and other error-prone
- X constructs in the script.
- X\endtable
- X
- X\beginsection 2. Literals
- X
- X\outtext
- X
- XNumeric: |123|, |123.4|, |5E-10|, |0xff| (hex), |0377| (octal).
- X
- XString: |"abc"|, |'abc'|.
- X Variables are interpolated when |"|\dots|"| are used. \hfil\break
- X |q/|\dots|/|
- X can be used instead of |'|\dots|'|, |qq/|\dots|/| instead of |"|\dots|"|,
- X (any delimiter instead of |/|\dots|/|).
- X
- XArray: |(1,2,3)|. |()| is empty array.
- X Also: |($a,$b,@rest) = (1,2,|\dots|);|
- X Enums are fine: |(1..4)| is |(1,2,3,4)|. Likewise |('abc'..'ade')|.
- X
- XFilehandles:
- X|<STDIN>|, |<STDOUT>|, |<STDERR>|, |<handle>|, |<$var>|.
- X|<>| is the input stream formed by the files specified in |@ARGV|,
- Xor |STDIN| if no arguments are supplied.
- X
- XGlobs:
- X|<pattern>| evaluates to all filenames according to the pattern.
- XUse |<${var}>| to glob from a variable.
- X
- XCommands:
- X|`command`| evaluates to the output of the command.
- X
- XHere-Is: |<<identifier| |#| the identifier must follow |<<| immediately
- X \hfill\break
- X{\it input text} \hfill\break
- X|identifier|
- X
- X\beginsection 3. Variables
- X
- X\table 1.2in
- X
- X|$var|
- X a simple scalar variable
- X
- X|$var[28]|
- X 29th element of array |@var| (the |[]| are part of it)
- X
- X|$var{'Feb'}|
- X one value from associative array |%var|
- X
- X|$#var|
- X last index of array |@var|
- X
- X|@var|
- X the entire array
- X
- X|@var[3,4,5]|
- X a slice of the array |@var|
- X
- X|@var{'a','b'}|
- X a slice of |%var|; same as |($var{'a'},$var{'b'})|
- X
- X|%var|
- X the entire associative array
- X
- X|$var{'a',1,|\dots|}|
- X emulates a multi-dimensional array
- X
- X|('a',1,|\dots|)[4]|
- X subscripts an array literal
- X
- X|*name|
- X refers to all objects represented by name. \hfil\break
- X ``|*name1 = *name2|'' makes |name1| identical to |name2|.
- X\endtable
- X
- X\beginsection 4. Statements
- X
- X\text
- X
- XEvery statement is an expression, optionally followed by a modifier, and
- Xterminated by a semi-colon.
- X
- XExecution of expressions can depend on other expressions using one of
- Xthe modifiers ``if'', ``unless'', ``while'' or ``until'', e.g.:
- X$$\vbox{
- X\hbox{<EXPR1> if <EXPR2>;}
- X\hbox{<EXPR1> until <EXPR2>;}}$$
- X
- XAlso, by using one of the logical operators ``\|\|'', ``|&&|''
- Xor ``|?:|'', e.g.:
- X$$\vbox{
- X\hbox{<EXPR1> \|\| <EXPR2>;}
- X\hbox{<EXPR1> ? <EXPR2> : <EXPR3>;}}$$
- X
- XStatements can be combined to form a <BLOCK> when enclosed in |{}|.
- X
- XCompound statements may be used to control flow (|[]| denote optional
- Xparts, \* means: defaults to |$_| if omitted):
- X$$\vbox{
- X\hbox{if (<EXPR>) <BLOCK> [ [ elsif (<EXPR>) <BLOCK> \dots\ ] else <BLOCK> ]}
- X\hbox{unless (<EXPR>) <BLOCK> [ else <BLOCK> ]}
- X\hbox{[<LABEL>:] while (<EXPR>) <BLOCK> [ continue <BLOCK> ]}
- X\hbox{[<LABEL>:] until (<EXPR>) <BLOCK> [ continue <BLOCK> ]}
- X\hbox{[<LABEL>:] for (<EXPR>; <EXPR>; <EXPR>) <BLOCK>}
- X\hbox{[<LABEL>:] foreach <VAR>\*\ (<ARRAY>) <BLOCK>}
- X\hbox{[<LABEL>:] <BLOCK> [ continue <BLOCK> ]}}$$
- X
- XSpecial forms are:
- X$$\vbox{
- X\hbox{do <BLOCK> while <EXPR>;}
- X\hbox{do <BLOCK> until <EXPR>;}}$$
- Xwhich are guaranteed to perform <BLOCK> once before testing <EXPR>.
- X
- X\beginsection 5. Flow control
- X
- X\table 1in
- X
- Xdo <BLOCK>
- XReturns the value of the last command in the sequence of
- Xcommands indicated by <BLOCK>.
- X
- Xdo <SUBROUTINE> (<LIST>)
- XExecutes a <SUBROUTINE> declared by a |sub| declaration, and
- Xreturns the value of the last expression evaluated in
- X<SUBROUTINE>. Also: |&|<SUBROUTINE>.
- X
- Xdo <EXPR>
- XUses the value of <EXPR> as a filename and executes the contents of
- Xthe file as a perl script. Errors are returned in |$@|.
- X
- Xgoto <LABEL>
- XContinue execution at the specified label.
- X
- Xlast [<LABEL>]
- XImmediately exits the loop in question. Skips continue block.
- X
- Xnext [<LABEL>]
- XStarts the next iteration of the loop.
- X
- Xredo [<LABEL>]
- XRestarts the loop block without evaluating the conditional again.
- X
- Xreturn <EXPR>
- XReturns from a subroutine with the value specified.
- X\endtable
- X
- X\beginsection 6. Operators
- X
- X\table 1in
- X
- X|+| |-| |*| |/|
- XAddition, subtraction, multiplication, division.
- X
- X|%|
- XModulo division.
- X
- X\| |&| |^|
- XBitwise or, bitwise and, bitwise exclusive or.
- X
- X|>>| |<<|
- XBitwise shift right, bitwise shift left.
- X
- X|**|
- XExponentiation.
- X
- X|.|
- XConcatenation of two strings.
- X
- X|x|
- XReturns a string consisting of the left operand repeated the
- Xnumber of times specified by the right operand.
- X
- X\medskip\noindent
- XAll of the above operators also have an assignment operator, e.g. ``|.=|''.
- X\medskip
- X
- X|++| |--|
- XAuto-increment (magical on strings), auto-decrement.
- X
- X|?:|
- XAlternation (if-then-else) operator.
- X
- X\|\| |&&|
- XLogical or, logical and.
- X
- X|==| |!=|
- XNumeric equality, inequality.
- X
- X|eq| |ne|
- XString equality, inequality.
- X
- X|<| |>|
- XNumeric less than, greater than.
- X
- X|lt| |gt|
- XString less than, greater than.
- X
- X|<=| |>=|
- XNumeric less (greater) than or equal to.
- X
- X|le| |ge|
- XString less (greater) than or equal.
- X
- X|=~| |!~|
- XSearch pattern, substitution, or translation (negated).
- X
- X|..|
- XEnumeration, also input line range operator.
- X
- X|,|
- XComma operator.
- X\endtable
- X
- X\beginsection 7. File test operators
- X
- X\text
- X
- X%%rjc%% Changed "This unary operator" to "These unary operators"
- X%%rjc%% and concomitant grammar changes
- X
- XThese unary operators take one argument, either a filename or a
- Xfilehandle, and test the associated file to see if something is true about
- Xit. If the argument is omitted, tests |$_|
- X(except for |-t|, which tests |STDIN|).
- XIf the special argument |_| (underscore) is passed, uses the info of the
- Xpreceding test.
- X\medskip
- X
- X\table 1in
- X
- X|-r|/|-w|/|-x|/|-o|
- XFile is readable/writable/executable/owned by effective uid.
- X
- X|-R|/|-W|/|-X|/|-O|
- XFile is readable/writable/executable/owned by real uid.
- X
- X|-e|/|-z|/|-s|
- XFile exists / has zero/non-zero size.
- X
- X|-f|/|-d|
- XFile is a plain file, a directory.
- X
- X|-l|/|-S|/|-p|
- XFile is a symbolic link, a socket, a named pipe (FIFO).
- X
- X|-b|/|-c|
- XFile is a block/character special file.
- X
- X|-u|/|-g|/|-k|
- XFile has setuid/setgid/sticky bit set.
- X
- X|-t|
- XTests if filehandle (STDIN by default) is opened to a tty.
- X
- X|-T|/|-B|
- XFile is a text/non-text (binary) file. Both |-T| and |-B| return
- X<TRUE> on a null file, or a file at EOF when testing a
- Xfilehandle.
- X
- X\text
- X\medskip
- XAn |*| after the parameter list indicates that this function may be used
- Xeither as a function or as a unary operator, without the parentheses.
- XThe symbol \*\ after a parameter indicates that this parameter will default
- Xto |$_| if omitted.
- X
- X\beginsection 8. Arithmetic functions
- X
- X\table1.2in
- X
- Xatan2($X$,$Y$)
- XReturns the arctangent of $X/Y$ in the range $-\pi$ to $\pi$.
- X
- Xcos(<EXPR>\*)*
- XReturns the cosine of <EXPR> (expressed in radians).
- X
- Xexp(<EXPR>\*)*
- XReturns e to the power of <EXPR>.
- X
- Xint(<EXPR>\*)*
- XReturns the integer portion of <EXPR>.
- X
- Xlog(<EXPR>\*)*
- XReturns natural logarithm (base $e$) of <EXPR>.
- X
- Xrand [(<EXPR>)*]
- XReturns a random fractional number between 0 and the value of
- X<EXPR>. If <EXPR> is omitted, returns a value between 0 and 1.
- X
- Xsin(<EXPR>\*)*
- XReturns the sine of <EXPR> (expressed in radians).
- X
- Xsqrt(<EXPR>\*)*
- XReturn the square root of <EXPR>.
- X
- Xsrand[(<EXPR>)*]
- XSets the random number seed for the rand operator.
- X
- Xtime
- XReturns the number of seconds since January 1, 1970. Suitable for
- Xfeeding to gmtime(\dots) and localtime(\dots).
- X\endtable
- X
- X\beginsection 9. Conversion functions
- X
- X\table 1.2in
- X
- Xgmtime(<EXPR>)*
- XConverts a time as returned by the time function to a 9-element
- Xarray |($sec, $min, $hour, $mday, $mon, $year, $wday, $yday,
- X$isdst)| with the time analyzed for the Greenwich timezone. |$mon|
- Xhas the range $0\ldots11$ and |$wday| has the range $0\ldots6$.
- X
- X%%rjc%% \* added
- Xhex(<EXPR>\*)*
- XReturns the decimal value of <EXPR> interpreted as an hex string.
- X
- Xlocaltime(<EXPR>)*
- XConverts a time as returned by the time function to a 9-element
- Xarray with the time analyzed for the local timezone.
- X
- X%%rjc%% \* added
- Xoct(<EXPR>\*)*
- XReturns the decimal value of <EXPR> interpreted as an octal string.
- XIf <EXPR> starts off with 0x, interprets it as a hex string instead.
- X
- Xord(<EXPR>\*)*
- XReturns the ascii value of the first character of <EXPR>.
- X
- Xvec(<EXPR>,<OFFSET>,<BITS>)
- XTreats <EXPR> as a string of unsigned ints, and yields the bit at
- X<OFFSET>. <BITS> must be between 1 and 32. May be used as an
- Xlvalue.
- X\endtable
- X
- X\text
- X\medskip
- XA <LIST> is a (possibly parenthesised) list of expressions, variables or
- X<LIST>s. In all circumstances, an array variable or an array slice may be
- Xused instead of a <LIST>.
- X
- X\beginsection 10. Structure conversion
- X
- X\table 1.2in
- X
- Xpack(<TEMPLATE>,<LIST>)
- XPacks the values into a binary structure using <TEMPLATE>.
- X
- Xunpack(<TEMPLATE>,<EXPR>)
- XUnpacks the structure <EXPR> into an array, using <TEMPLATE>.
- X\endtable
- X
- X\text
- X\medskip
- X<TEMPLATE> is a sequence of characters as follows:
- X
- X\table .4in
- X|a|/|A|
- X Ascii string, null/space padded
- X
- X|c|/|C|
- X Native/unsigned char value
- X
- X|s|/|S|
- X Signed/unsigned short value
- X
- X|i|/|I|
- X Signed/unsigned integer value
- X
- X|l|/|L|
- X Signed/unsigned long value
- X
- X|n|/|N|
- X Short/long in network byte order
- X
- X|p|
- X Pointer to a string
- X
- X|x|
- X Null byte
- X\endtable
- X\text
- X\medskip
- XEach character may be followed by a decimal number which will be used
- Xas a repeat count. Spaces may be included in the template for readability
- Xpurposes.
- X
- X\beginsection 11. String functions
- X
- X\table 1.2in
- X
- Xchop(<LIST>\*)
- XChops off the last character on all elements of the list; returns the
- Xlast chopped character. The parentheses may be omitted if <LIST> is
- Xa single variable.
- X
- Xcrypt(<PLAINTEXT>,<SALT>)
- XEncrypts a string.
- X
- X%%rjc%%\* added
- Xeval(<EXPR>\*)*
- X<EXPR> is parsed and executed as if it were a little perl program.
- XThe value returned is the value of the last expression evaluated. If
- Xthere is a syntax error or runtime error, an undefined string is
- Xreturned by eval, and |$@| is set to the error message.
- X
- Xindex(<STR>,<SUBSTR>)
- XReturns the position of <SUBSTR> in <STR>. If the substring is not
- Xfound, returns |$[|${}-1$.
- X
- X%%rjc%% \* added
- Xlength(<EXPR>\*)*
- XReturns the length in characters of the value of <EXPR>.
- X
- Xrindex(<STR>,<SUBSTR>)
- XReturns the position of the last occurrence of <SUBSTR> in <STR>.
- X
- Xsubstr(<EXPR>,<OFFSET>,<LEN>)
- XExtracts a substring out of <EXPR> and returns it. If <OFFSET> is
- Xnegative, counts from the end of the string. May be used as an
- Xlvalue.
- X\endtable
- X
- X\beginsection 12. Array and list functions
- X
- X\table 1.2in
- X
- Xdelete |$|<ARRAY>$\{$<KEY>$\}$
- XDeletes the specified value from the specified associative array.
- XReturns the deleted value.
- X
- Xeach(|%|<ARRAY>)*
- XReturns a 2-element array consisting of the key and value for the
- Xnext value of an associative array. Entries are returned in an
- Xapparently random order. When the array is entirely read, a null
- Xarray is returned. The next call to each(\dots) after that will start
- Xiterating again.
- X
- Xgrep(<EXPR>,<LIST>)
- XEvaluates <EXPR> for each element of the <LIST>, locally setting |$_| to
- Xrefer to the element. Modifying |$_| will modify the corresponding
- Xelement from <LIST>. Returns array of elements from <LIST> for
- Xwhich <EXPR> returned true.
- X
- Xjoin(<EXPR>,<LIST>)
- XJoins the separate strings of <LIST> into a single string with fields
- Xseparated by the value of <EXPR>, and returns the string.
- X
- Xkeys(|%|<ARRAY>)*
- XReturns a normal array consisting of all the keys of the named
- Xassociative array.
- X
- Xpop(|@|<ARRAY>)*
- XPops and returns the last value of the array, shortens the array by 1.
- X
- Xpush(|@|<ARRAY>,<LIST>)
- XPushes the values of <LIST> onto the end of <ARRAY>. The length of
- X<ARRAY> increases by the length of <LIST>.
- X
- Xreverse(<LIST>)*
- XReturns the <LIST> in reverse order.
- X
- Xshift[(|@|<ARRAY>)*]
- XShifts the first value of the array off and returns it, shortening the
- Xarray by 1 and moving everything down. If |@|<ARRAY> is omitted,
- Xshifts |@ARGV| in main and |@_| in subroutines.
- X
- Xsort([<SUBROUTINE>] <LIST>)*
- XSorts the <LIST> and returns the sorted array value. If
- X<SUBROUTINE> is specified, gives the name of a subroutine that
- Xreturns less than zero, zero, or greater than zero, depending on how
- Xthe elements of the array, available to the routine as |$a| and |$b|, are
- Xto be ordered.
- X
- Xsplice(|@|<ARRAY>,<OFFSET>[,<LENGTH>[,<LIST>]])
- XRemoves the elements of |@|<ARRAY> designated by <OFFSET> and
- X<LENGTH>, and replaces them with <LIST> (if specified).
- XReturns the elements removed.
- X
- Xsplit[(/<PATTERN>/[,<EXPR>\*[,<LIMIT>]])]
- XSplits a string into an array of strings, and returns it. If <LIMIT> is
- Xspecified, splits in no more than that many fields. If <PATTERN> is
- Xalso omitted, splits on whitespace (\hbox{|/[ \t\n]+/|}). If not in array
- Xcontext: returns number of fields and splits to |@_|.
- X
- Xunshift(|@|<ARRAY>,<LIST>)
- XPrepends list to the front of the array, and returns the number of
- Xelements in the new array.
- X
- Xvalues(|%|<ARRAY>)*
- XReturns a normal array consisting of all the values of the named
- Xassociative array.
- X\endtable
- X
- X\beginsection 13. File operations
- X
- X\text
- X
- XFunctions operating on a list of files return the number of files
- Xsuccessfully operated upon.
- X\medskip
- X
- X\table 1.2in
- X
- Xchmod(<LIST>)*
- XChanges the permissions of a list of files. The first element of the
- Xlist must be the numerical mode.
- X
- Xchown(<LIST>)*
- XChanges the owner and group of a list of files. The first two
- Xelements of the list must be the numerical uid and gid.
- X
- Xlink(<OLDFILE>,<NEWFILE>)
- XCreates a new filename linked to the old filename.
- X
- Xlstat(<FILE>)
- XLike stat, but does not traverse a final symbolic link.
- X
- Xmkdir(<DIR>,<MODE>)
- XCreates a directory with given permissions. Sets |$!| on failure.
- X
- Xselect(<RBITS>,<WBITS>,<NBITS>,<TIMEOUT>)
- XPerforms a select(2) system call with the same parameters.
- X
- Xreadlink(<EXPR>\*)*
- XReturns the value of a symbolic link.
- X
- Xrename(<OLDNAME>,<NEWNAME>)
- XChanges the name of a file.
- X
- Xrmdir(<FILENAME>\*)*
- XDeletes the directory if it is empty. Sets |$!| on failure.
- X
- Xstat(<FILE>)
- XReturns a 13-element array |($dev, $ino, $mode, $nlink, $uid, $gid,
- X$rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks)|. <FILE> can
- Xbe a filehandle, an expression evaluating to a filename, or |_| to refer
- Xto the last file test operation. The parentheses may be omitted if
- X<FILE> is a filehandle, a variable, or |_|.
- X
- Xsymlink(<OLDFILE>,<NEWFILE>)
- XCreates a new filename symbolically linked to the old filename.
- X
- Xunlink(<LIST>)*
- XDeletes a list of files.
- X
- Xutime(<LIST>)*
- XChanges the access and modification times on each file of a list of
- Xfiles. The first two elements of the list must be the numerical
- Xaccess and modification times.
- X\endtable
- X
- X\beginsection 14. Directory reading routines
- X
- X\table1.2in
- X
- Xclosedir(<DIRHANDLE>)*
- XCloses a directory opened by opendir.
- X
- Xopendir(<DIRHANDLE>,<DIRNAME>)
- XOpens a directory on the handle specified.
- X
- Xreaddir(<DIRHANDLE>)*
- XReturns the next entry (or an array of entries) in the directory.
- X
- Xrewinddir(<DIRHANDLE>)*
- XPositions the directory to the beginning.
- X
- Xseekdir(<DIRHANDLE>,<POS>)
- XSets position for readdir on the directory.
- X
- Xtelldir(<DIRHANDLE>)*
- XReturns the postion in the directory.
- X\endtable
- X
- X\beginsection 15. Input/Output
- X
- X\text
- XIn input/output operations, <FILEHANDLE> may be a filehandle as
- Xopened by the ``open'' operator, or a scalar variable which evaluates to
- Xthe name of a filehandle to be used.
- X\medskip
- X
- X\table1.2in
- X
- X%%rjc%% MS-DOS properly capitalized
- Xbinmode(<FILEHANDLE>)*
- XArranges for the file opened on <FILEHANDLE> to be read in
- X``binary'' mode as opposed to ``text'' mode (MS-DOS only).
- X
- Xclose(<FILEHANDLE>)*
- XCloses the file or pipe associated with the file handle.
- X
- Xdbmclose(|%|<ARRAY>)*
- XBreaks the binding between the array and the dbm file.
- X
- Xdbmopen(|%|<ARRAY>,<DBMNAME>, <MODE>)
- XBinds a dbm or ndbm file to the associative array. If the database
- Xdoes not exist, it is created with the indicated mode.
- X
- Xeof(<FILEHANDLE>)
- XReturns 1 if the next read will return end of file, or if the file is not
- Xopen.
- X
- Xeof
- XReturns the eof status for the last file read.
- X
- Xeof()
- XIndicates eof on the pseudo file formed of the files listed on the
- Xcommand line.
- X
- Xfcntl(<FILEHANDLE>,<FUNCTION>,|$|<VAR>)
- XImplements the fcntl(2) function. This function has non-standard
- Xreturn values. See the manual for details.
- X
- Xfileno(<FILEHANDLE>)*
- XReturns the file descriptor for a given (open) file.
- X
- Xflock(<FILEHANDLE>,<OPERATION>)
- XCalls flock(2) on the file. <OPERATION> adds from 1 (shared), 2
- X(exclusive), 4 (non-blocking) or 8 (unlock).
- X
- Xgetc[(<FILEHANDLE>)*]
- XYields the next character from the file, or |NULL| on |EOF|. If
- X<FILEHANDLE> is omitted, reads from |STDIN|.
- X
- Xioctl(<FILEHANDLE>,<FUNCTION>,|$|<VAR>)
- Xperforms ioctl(2) on the file. This function has non-standard return
- Xvalues. See the manual for details.
- X
- Xopen(<FILEHANDLE>[,<FILENAME>])
- XOpens a file and associates it with <FILEHANDLE>. If <FILENAME>
- Xis omitted, the scalar variable of the same name as the
- X<FILEHANDLE> must contain the filename. The filename may be
- Xoptionally preceded by ``|>|'', ``|>>|'' or ``|<|'' to select
- Xoutput/append/input mode. Default mode is input. Precede with
- X``|+|'' to select read/write access. Use ``|&|\dots'' to connect
- Xto an already
- Xopened filehandle. Pipes to/from commands may be opened with
- X``\|\dots'' and ``\dots\|'' . Open returns 1 upon success, undef otherwise,
- Xexcept for pipes. The parentheses may be omitted, if only a
- X<FILEHANDLE> is specified.
- X
- Xpipe(<READHANDLE>,<WRITEHANDLE>)
- XReturns a pair of connected pipes.
- X
- Xprint[([<FILEHANDLE>] <LIST>\*)*]
- XPrints a string or a comma-separated list of strings. If
- X<FILEHANDLE> is omitted, prints by default to standard output (or
- SHAR_EOF
- echo "End of perlref.tex part 1"
- echo "File perlref.tex is continued in part 2"
- echo "2" > shar3_seq_.tmp
- exit 0
- --
- Johan Vromans jv@mh.nl via internet backbones
- Multihouse Automatisering bv uucp: ..!{uunet,hp4nl}!mh.nl!jv
- Doesburgweg 7, 2803 PL Gouda, The Netherlands phone/fax: +31 1820 62944/62500
- ------------------------ "Arms are made for hugging" -------------------------
-