home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
1
/
1453
(
.txt
)
< prev
next >
Wrap
LaTeX Document
|
1990-12-28
|
18KB
From: jv@mh.nl (Johan Vromans)
Newsgroups: comp.lang.perl,alt.sources
Subject: TeX version of the Perl Reference Guide - part 2 of 2
Message-ID: <JV.90Jun13104035@squirrel.mh.nl>
Date: 13 Jun 90 16:40:35 GMT
X-Checksum-Snefru: c6f43ab6 93f2ec62 57dadb6f 90ef96b6
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/part02
---- Cut Here and unpack ----
#!/bin/sh
# this is xxx.02 (part 2 of perlref.tex)
# do not concatenate these parts, unpack them in order with /bin/sh
# file perlref.tex continued
if touch 2>&1 | fgrep '[-amc]' > /dev/null
then TOUCH=touch
else TOUCH=true
if test ! -r shar3_seq_.tmp; then
echo "Please unpack part 1 first!"
exit 1
(read Scheck
if test "$Scheck" != 2; then
echo "Please unpack part $Scheck next!"
exit 1
else
exit 0
) < shar3_seq_.tmp || exit 1
echo "x - Continuing file perlref.tex"
sed 's/^X//' << 'SHAR_EOF' >> perlref.tex &&
Xto the last selected output channel---see select(\dots)).
Xprintf[([<FILEHANDLE>] <LIST>)*]
XEquivalent to ``print <FILEHANDLE> sprintf(<LIST>)''.
Xread(<FILEHANDLE>,|$|<VAR>,<LENGTH>)
XRead <LENGTH> binary bytes from the file into the variable.
XReturns number of bytes actually read.
Xseek(<FILEHANDLE>,<POSITION>,<WHENCE>)
XRandomly positions the file. Returns 1 upon success, 0 otherwise.
Xselect(<FILEHANDLE>)*
XSets the current default filehandle for output operations. Returns
Xthe previously selected filehandle.
Xsprintf(<FORMAT>,<LIST>)
XReturns a string formatted by (almost all of) the usual printf
Xconventions.
Xtell[(<FILEHANDLE>)]*
XReturns the current file position for the file. If <FILEHANDLE> is
Xomitted, assumes the file last read.
Xwrite[(<FILEHANDLE>)]*
XWrites a formatted record to the specified file, using the format
Xassociated with that file. See Formats.
X\endtable
X\beginsection 16. Search and replace functions
X\table 1.2in
X[<EXPR> |=~|] [m]/<PATTERN>/[i][o]
XSearches a string for a pattern. If no string is specified via the |=~|
Xor |!~| operator, the |$_| string is searched. If you prepend an ``m'' you
Xcan use any pair of characters as delimiters. If the final delimiter is
Xfollowed by the optional letter ``i'', the matching is done in a
Xcase-insensitive manner. If you append ``o'', variables are interpolated
Xonly once. If used in a context that requires an array value, a
Xpattern match returns an array consisting of the subexpressions
Xmatched by the parentheses in pattern, i.e. |($1, $2, $3|\dots|)|.
X?<PATTERN>?
XThis is just like the /pattern/ search, except that it matches only
Xonce between calls to the reset operator.
X[|$|<VAR> |=~|] s/<PATTERN>/REPLACEMENT/[g][i][e][o]
XSearches a string for a pattern, and if found, replaces that pattern
Xwith the replacement text and returns the number of substitutions
Xmade. Otherwise it returns false (0). Optional modifiers: ``g''
Xindicates that all occurrences of the pattern are to be replaced; ``e''
Xindicates that the replacement string is to be interpreted as an
Xexpression, ``i'' and ``o'' as with /<PATTERN>/ matching. Any
Xdelimiter may replace the slashes; if single quotes are used, no
Xinterpretation is done on the replacement string.
Xstudy[(|$|<VAR>\*)*]
XStudy the contents of |$|<VAR> in anticipation of doing many pattern
Xmatches on the contents before it is next modified.
X[|$|<VAR> |=~|] tr/<SEARCHLIST>/<REPLACEMENTLIST>/
XTranslates all occurrences of the characters found in the search list
Xwith the corresponding character in the replacement list. It returns
Xthe number of characters replaced. ``y'' may be used instead of ``tr''.
X\endtable
X\beginsection 17. System interaction
X\table1.2in
Xchdir [(<EXPR>)*]
XChanges the working directory, |$HOME| if <EXPR> is omitted.
Xchroot(<FILENAME>\*)*
XChanges the root for the following commands.
Xdie(<LIST>)*
XPrints the value of <LIST> to |STDERR| and exits with the current
Xvalue of |$!| (errno). If |$!| is 0, exits with the value of |($? >> 8)|
X(|`command`| status). If |($? >> 8)| is 0, exits with 255.
Xexec(<LIST>)*
XExecutes the system command in <LIST>.
Xexit(<EXPR>)*
XExits immediately with the value of <EXPR>.
Xfork
XDoes a fork() call. Returns the child pid to the parent process and
Xzero to the child process.
Xgetlogin
XReturns the current login name from |/etc/utmp|.
Xgetpgrp[(<PID>)*]
XReturns the process group for process <PID> (0, or omitted, means
Xthe current process).
Xgetppid
XReturns the process id of the parent process.
Xgetpriority(<WHICH>,<WHO>)
XReturns the current priority for a process, process group, or user.
Xkill(<LIST>)*
XSends a signal to a list of processes. The first element of the list
Xmust be the signal to send (numeric, or its name as a string).
Xsetpgrp(<PID>,<PGRP>)
XSets the process group for the <PID> (0 = current process).
Xsetpriority(<WHICH>,<WHO>,<PRIO>)
XSets the current priority for a process, process group or a user.
Xsleep[(<EXPR>)*]
XCauses the script to sleep for <EXPR> seconds, or forever if no
X<EXPR>. Returns the number of seconds actually slept.
Xsyscall(<LIST>)*
XCalls the system call specified in the first element of the list,
Xpassing the rest of the list as arguments to the call.
Xsystem(<LIST>)*
XDoes exactly the same thing as ``exec <LIST>'' except that a fork is
Xdone first, and the parent process waits for the child process to
Xcomplete.
Xtimes
XReturns a 4-element array |($user, $system, $cuser, $csystem)|
Xgiving the user and system times, in seconds, for this process and
Xthe children of this process.
Xumask[(<EXPR>)*]
XSets the umask for the process and returns the old one. If <EXPR> is
Xomitted, returns current umask value.
Xwait
XWaits for a child process to terminate and returns the pid of the
Xdeceased process ($-1$ if none). The status is returned in |$?|.
Xwarn(<LIST>)*
XPrints the message on |STDERR| like die(\dots), but doesn't exit.
X\endtable
X\beginsection 18. Networking
X\table1.2in
Xaccept(<NEWSOCKET>,<GENERICSOCKET>)
XAccepts a new socket.
Xbind(<SOCKET>,<NAME>)
XBinds the <NAME> to the <SOCKET>.
Xconnect(<SOCKET>, <NAME>)
XConnects the <NAME> to the <SOCKET>.
Xgetpeername(<SOCKET>)
XReturns the socket address of the other end of the <SOCKET>.
Xgetsockname(<SOCKET>)
XReturns the name of the socket.
Xgetsockopt(<SOCKET>,<LEVEL>,<OPTNAME>)
XReturns the socket options.
Xlisten(<SOCKET>,<QUEUESIZE>)
XStarts listening on the specified <SOCKET>.
Xrecv(<SOCKET>,<SCALAR>,<LENGTH>,<FLAGS>)
XReceives a message on <SOCKET>.
Xsend(<SOCKET>,<MSG>,<FLAGS>[,<TO>])
XSends a message on the <SOCKET>.
Xsetsockopt(<SOCKET>,<LEVEL>,<OPTNAME>,<OPTVAL>)
XSets the requested socket option.
Xshutdown(<SOCKET>,<HOW>)
XShuts down a <SOCKET>.
Xsocket(<SOCKET>,<DOMAIN>,<TYPE>,<PROTOCOL>)
XCreates a <SOCKET> in <DOMAIN> with <TYPE> and <PROTOCOL>.
Xsocketpair(<SOCKET1>,<SOCKET2>,<DOMAIN>,<TYPE>,<PROTOCOL>)
XAs socket, but creates a pair of bi-directional sockets.
X\endtable
X\beginsection 19. Miscellaneous
X\table1.2in
Xdefined(<EXPR>)*
XTests whether the lvalue <EXPR> has a real value.
Xdump [<LABEL>]
XImmediate core dump. When reincarnated, starts at <LABEL>.
Xlocal(<LIST>)
XDeclares the listed variables to be local to the enclosing block,
Xsubroutine or eval.
Xpackage <NAME>
XDesignates the remainder of the current block as a package, having
Xa separate namespace.
X%%rjc%% Changed "not omitted" to "supplied"
Xreset [(<EXPR>)*]
XResets |??| searches so that they work again. If <EXPR> is supplied,
Xit is interpreted as a list of single characters (hyphens allowed for
Xranges). All variables and arrays beginning with one of those
Xletters are reset to their pristine state. Only affects the current
Xpackage.
Xsub <NAME> $\{$ <EXPR>; \dots\ $\}$
XDesignates <NAME> as a subroutine. Parameters are passed as array
X|@_|. Returns the value of the last expression evaluated.
Xundef[(<LVALUE>)*]
XUndefines the <LVALUE>. Always returns the undefined value.
Xwantarray
XReturns true if the current context expects an array value.
X\endtable
X\beginsection 20. Info from system files
X|/etc/passwd|.
XInfo is |($name, $passwd, $uid, $gid, $quota, $comment, $gcos, $dir,
X$shell)|.
X\medskip
X\table2.4in
Xendpwent
XEnds lookup processing.
Xgetpwent
XGets next info.
Xgetpwnam(<NAME>)
XGets info by name.
Xgetpwuid(<UID>)
XGets info by uid.
Xsetpwent
XResets lookup processing.
X\endtable
X\text \medskip
X|/etc/group|.
XInfo is a 4-item array: |($name, $passwd, $gid, $members)|.
X\medskip
X\table2.4in
Xendgrent
XEnds lookup processing.
Xgetgrgid(<GID>)
XGets info by group id.
Xgetgrnam(<NAME>)
XGets info by name.
Xgetgrent
XGets next info.
Xsetgrent
XResets lookup processing.
X\endtable
X\text \medskip
X|/etc/hosts|.
XInfo is |($name, $aliases, $addrtype, $length, @addrs)|.
X\medskip
X\table2.4in
Xendhostent
XEnds lookup processing.
Xgethostbyname(<NAME>)
XGets info by name.
Xgethostent
XGets next info.
Xsethostent(<STAYOPEN>)
XResets lookup processing.
X\endtable
X\text\medskip
X|/etc/networks|.
XInfo is |($name, $aliases, $addrtype, $net)|.
X\medskip
X\table2.4in
Xendnetent
XEnds lookup processing.
Xgetnetbyaddr(<ADDR>,<TYPE>)
XGets info by address and type.
Xgetnetbyname(<NAME>)
XGets info by name.
Xgetnetent
XGets next info.
Xsetnetent(<STAYOPEN>)
XResets lookup processing.
X\endtable
X\text\medskip
X|/etc/services|.
XInfo is |($name, $aliases, $port, $proto)|.
X\medskip
X\table2.4in
Xendservent
XEnds lookup processing.
Xgetservbyname(<NAME>, <PROTO>)
XGets info by name.
Xgetservbyport(<PORT>, <PROTO>)
XGets info by port.
Xgetservent
XGets next info.
Xsetservent(<STAYOPEN>)
XResets lookup processing.
X\endtable
X\text\medskip
X|/etc/protocols|.
XInfo is |($name, $aliases, $proto)|.
X\medskip
X\table2.4in
Xendprotoent
XEnds lookup processing.
Xgetprotobyname(<NAME>)
XGets info by name.
Xgetprotobynumber(<NUMBER>)
XGets info by number.
Xgetprotoent
XGets next info.
Xsetprotoent(<STAYOPEN>)
XResets lookup processing.
X\endtable
X\beginsection 21. Regular expressions
X\text
XStandard UNIX regular expressions, with the following additions:
X\medskip
X\table1.2in
X|(| |)| \| |{| |}|
Xdo not have to be escaped with a |\|.
Xmatches the preceding pattern element one or more times.
Xmatches zero or one times.
X%%rjc%% syntax elaborated
X|{|$n$ [|,| [$m$]] |}|
Xdenote the minimum ($n$)
Xand maximum ($m$) match count. If |,| is omitted, uses $m=n$.
XIf $m$ is omitted but |,| is present, uses $m=\infty$.
X|\w|
Xmatches alphanumeric, including ``|_|'', |\W| matches non-alphanumeric.
X|\b|
Xmatches word boundaries, |\B| matches non-boundaries.
X|\s|
Xmatches whitespace, |\S| matches non-whitespace.
X|\d|
Xmatches numeric, |\D| matches non-numeric.
X\endtable
X\text\medskip
X|\n|, |\r|, |\f|, |\t| and |\|<NNN> have their usual meaning.
X|\w|, |\s| and |\d| may be used within character classes, |\b|
Xdenotes backspace in this context.
X|\1| \dots\ |\9| refer to matched sub-expressions inside the match.
X|$1| \dots\ |$9| can be used to refer to matched sub-expressions outside the
Xmatching.
X\medskip
X\table1.2in
X|$+|
Xreturns whatever the last bracket match matched.
X|$&|
Xreturns the entire matched string.
X|$`|
Xreturns everything before the matched string.
X|$'|
Xreturns everything after the matched string.
X\endtable
X\beginsection 22. Formats
X\text
Xformat [<NAME>] = \hfil\break
X<FORMLIST> \hfil\break
X<FORMLIST> pictures the lines, and contains the arguments which will
Xgive values to the fields in the lines. Picture fields are:
X\table1in
X|@<<<|\dots
Xleft adjusted field, the ``|<|'' is repeated to denote the
Xlength of the field;
X|@>>>|\dots
Xright adjusted field;
X|@|\|\|\|\dots
Xcentered field;
X|@*|
Xa multi-line field.
X\endtable
X\text\medskip
XUse ``|^|'' instead of ``|@|'' for multi-line block filling.
XUse ``|~|'' at the beginning of a line to suppress unwanted empty lines.
XUse ``|~~|'' at the beginning of a line to have this format line repeated
Xuntil all fields are exhausted.
XSet |$-| to zero to force a page break.
X\beginsection 23. Special variables
X\text
XThe following variables are global and should be localized in subroutines:
X\medskip
X\table.25in
X|$_|
XThe default input and pattern-searching space.
X|$.|
XThe current input line number of the last filehandle that was read.
X|$/|
XThe input record separator, newline by default.
X|$,|
XThe output field separator for the print operator.
X|$"|
XThe separator which joins elements of arrays interpolated in
X strings.
X|$\|
XThe output record separator for the print operator.
X|$#|
XThe output format for printed numbers. Initial value is ``|%.20g|''.
X|$*|
XSet to 1 to do multiline matching within a string, 0 to assume
Xstrings contain a single line. Default is 0.
X|$?|
XThe status returned by the last backtick (|`|\thinspace|`|) command,
Xpipe close or system operator.
X|$]|
XThe perl version string as displayed with ``|perl -v|''.
X|$[|
XThe index of the first element in an array, and of the first character
Xin a substring. Default is 0.
X|$;|
XThe subscript separator for multi-dimensional array emulation.
XDefault is |"\034"|.
X|$!|
XIf used in a numeric context, yields the current value of errno. If
Xused in a string context, yields the corresponding error string.
X|$@|
XThe perl error message from the last eval or ``do <EXPR>'' command.
X|$:|
XThe set of characters after which a string may be broken to fill
Xcontinuation fields (starting with ``|^|'') in a format.
X|$0|
XThe name of the file containing the perl script being executed.
X|$$|
XThe process number of the perl running this script. Altered (in the
Xchild process) by fork().
X|$<|
XThe real uid of this process.
X|$>|
XThe effective uid of this process.
X|$(|
XThe real gid of this process.
X|$)|
XThe effective gid of this process.
X\endtable
X\text \medskip
XThe following variables are context dependent and need not be localized:
X\medskip
X\table.25in
X|$%|
XThe current page number of the currently selected output channel.
X|$=|
XThe page length of the current output channel. Default is 60 lines.
X|$-|
XThe number of lines left on the page.
X|$~|
XThe name of the current report format.
X|$^|
XThe name of the current top-of-page format.
X|$|\|
XIf set to nonzero, forces a flush after every write or print on the
Xcurrently selected output channel. Default is 0.
X\medskip
X\hbox{The following variables are always local to the current block:}
X\medskip
X|$&|
XThe string matched by the last pattern match.
X|$`|
XThe string preceding what was matched by the last pattern match.
X|$'|
XThe string following what was matched by the last pattern match.
X|$+|
XThe last bracket matched by the last search pattern.
X|$1| \dots\ |$9|
XContains the subpattern from the corresponding set of parentheses
Xin the last pattern matched.
X\endtable
X\beginsection 24. Special arrays
X\table.5in
X|@ARGV|
XContains the command line arguments for the script (not
Xincluding the command name). See |$0| for the command
Xname.
X|@INC|
XContains the list of places to look for perl scripts to be
Xevaluated by the ``do <EXPR>'' command.
X|@_|
XParameter array for subroutines. Also used by split if not in
Xarray context.
X|%ENV|
XContains the current environment.
X|%SIG|
XUsed to set signal handlers for various signals.
X\endtable
X\beginsection 25. The perl debugger (invoked with {\tt perl -d})
X\table1.5in
XPrints out a help message.
XSingle steps.
XContinues (until breakpoint or exit).
X\cstok{RET}
XRepeats last ``|s|'' or ``|n|''.
XSingle steps around subroutine call.
X|l| [<RANGE>]
Xlists a range of lines. <RANGE> may be a number, start$-$end,
Xstart$+$amount, or a subroutine name. If omitted, continues last ``|l|''.
XLists lines that have breakpoints or actions.
XToggles trace mode.
X|b| [<LINE>]
XSets breakpoint at (current) line.
X|b| <SUBNAME>
XSets breakpoint at the subroutine.
XLists names of all subroutines.
X|d| <LINE>
XDeletes breakpoint at the given line.
XDeletes all breakpoints.
XDeletes all line actions.
X|V| [<PACKAGE>]
XLists all variables in a package. Default package is main.
X|a| <LINE> <COMMAND>
XSets an action for line.
X|<| <COMMAND>
XSets an action to be executed before every debugger prompt.
X|>| <COMMAND>
XSets an action to be executed before every ``|s|'', ``|c|'' or ``|n|''
Xcommand.
X|!| [ [|-|]<NUMBER>]
XRedo a debugging command. Default is previous command.
X|H| [|-|<NUMBER>]
XDisplays the last |-|number commands of more than one letter.
XQuits. You may also use your \cstok{EOF} character.
X<COMMAND>
XExecutes command as a perl statement.
X|p| <EXPR>\*
XPrints <EXPR>.
X\endtable
X\end
SHAR_EOF
echo "File perlref.tex is complete" &&
$TOUCH -am 0402093490 perlref.tex &&
chmod 0644 perlref.tex ||
echo "restore of perlref.tex failed"
set `wc -c perlref.tex`;Wc_c=$1
if test "$Wc_c" != "37522"; then
echo original size 37522, current size $Wc_c
rm -f shar3_seq_.tmp
echo "You have unpacked the last part"
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" -------------------------