jv@mh.nl (Johan Vromans) (06/13/90)
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 fi if test ! -r shar3_seq_.tmp; then echo "Please unpack part 1 first!" exit 1 fi (read Scheck if test "$Scheck" != 2; then echo "Please unpack part $Scheck next!" exit 1 else exit 0 fi ) < 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)). X Xprintf[([<FILEHANDLE>] <LIST>)*] XEquivalent to ``print <FILEHANDLE> sprintf(<LIST>)''. X Xread(<FILEHANDLE>,|$|<VAR>,<LENGTH>) XRead <LENGTH> binary bytes from the file into the variable. XReturns number of bytes actually read. X Xseek(<FILEHANDLE>,<POSITION>,<WHENCE>) XRandomly positions the file. Returns 1 upon success, 0 otherwise. X Xselect(<FILEHANDLE>)* XSets the current default filehandle for output operations. Returns Xthe previously selected filehandle. X Xsprintf(<FORMAT>,<LIST>) XReturns a string formatted by (almost all of) the usual printf Xconventions. X Xtell[(<FILEHANDLE>)]* XReturns the current file position for the file. If <FILEHANDLE> is Xomitted, assumes the file last read. X Xwrite[(<FILEHANDLE>)]* XWrites a formatted record to the specified file, using the format Xassociated with that file. See Formats. X\endtable X X X\beginsection 16. Search and replace functions X X\table 1.2in X 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 X?<PATTERN>? XThis is just like the /pattern/ search, except that it matches only Xonce between calls to the reset operator. X 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. X Xstudy[(|$|<VAR>\*)*] XStudy the contents of |$|<VAR> in anticipation of doing many pattern Xmatches on the contents before it is next modified. X 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 X\beginsection 17. System interaction X X\table1.2in X Xchdir [(<EXPR>)*] XChanges the working directory, |$HOME| if <EXPR> is omitted. X Xchroot(<FILENAME>\*)* XChanges the root for the following commands. X 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. X Xexec(<LIST>)* XExecutes the system command in <LIST>. X Xexit(<EXPR>)* XExits immediately with the value of <EXPR>. X Xfork XDoes a fork() call. Returns the child pid to the parent process and Xzero to the child process. X Xgetlogin XReturns the current login name from |/etc/utmp|. X Xgetpgrp[(<PID>)*] XReturns the process group for process <PID> (0, or omitted, means Xthe current process). X Xgetppid XReturns the process id of the parent process. X Xgetpriority(<WHICH>,<WHO>) XReturns the current priority for a process, process group, or user. X 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). X Xsetpgrp(<PID>,<PGRP>) XSets the process group for the <PID> (0 = current process). X Xsetpriority(<WHICH>,<WHO>,<PRIO>) XSets the current priority for a process, process group or a user. X Xsleep[(<EXPR>)*] XCauses the script to sleep for <EXPR> seconds, or forever if no X<EXPR>. Returns the number of seconds actually slept. X 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. X 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. X 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. X Xumask[(<EXPR>)*] XSets the umask for the process and returns the old one. If <EXPR> is Xomitted, returns current umask value. X Xwait XWaits for a child process to terminate and returns the pid of the Xdeceased process ($-1$ if none). The status is returned in |$?|. X Xwarn(<LIST>)* XPrints the message on |STDERR| like die(\dots), but doesn't exit. X\endtable X X\beginsection 18. Networking X X\table1.2in X Xaccept(<NEWSOCKET>,<GENERICSOCKET>) XAccepts a new socket. X Xbind(<SOCKET>,<NAME>) XBinds the <NAME> to the <SOCKET>. X Xconnect(<SOCKET>, <NAME>) XConnects the <NAME> to the <SOCKET>. X Xgetpeername(<SOCKET>) XReturns the socket address of the other end of the <SOCKET>. X Xgetsockname(<SOCKET>) XReturns the name of the socket. X Xgetsockopt(<SOCKET>,<LEVEL>,<OPTNAME>) XReturns the socket options. X Xlisten(<SOCKET>,<QUEUESIZE>) XStarts listening on the specified <SOCKET>. X Xrecv(<SOCKET>,<SCALAR>,<LENGTH>,<FLAGS>) XReceives a message on <SOCKET>. X Xsend(<SOCKET>,<MSG>,<FLAGS>[,<TO>]) XSends a message on the <SOCKET>. X Xsetsockopt(<SOCKET>,<LEVEL>,<OPTNAME>,<OPTVAL>) XSets the requested socket option. X Xshutdown(<SOCKET>,<HOW>) XShuts down a <SOCKET>. X Xsocket(<SOCKET>,<DOMAIN>,<TYPE>,<PROTOCOL>) XCreates a <SOCKET> in <DOMAIN> with <TYPE> and <PROTOCOL>. X Xsocketpair(<SOCKET1>,<SOCKET2>,<DOMAIN>,<TYPE>,<PROTOCOL>) XAs socket, but creates a pair of bi-directional sockets. X\endtable X X\beginsection 19. Miscellaneous X X\table1.2in X Xdefined(<EXPR>)* XTests whether the lvalue <EXPR> has a real value. X Xdump [<LABEL>] XImmediate core dump. When reincarnated, starts at <LABEL>. X Xlocal(<LIST>) XDeclares the listed variables to be local to the enclosing block, Xsubroutine or eval. X Xpackage <NAME> XDesignates the remainder of the current block as a package, having Xa separate namespace. X 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. X Xsub <NAME> $\{$ <EXPR>; \dots\ $\}$ XDesignates <NAME> as a subroutine. Parameters are passed as array X|@_|. Returns the value of the last expression evaluated. X Xundef[(<LVALUE>)*] XUndefines the <LVALUE>. Always returns the undefined value. X Xwantarray XReturns true if the current context expects an array value. X\endtable X X\beginsection 20. Info from system files X X|/etc/passwd|. XInfo is |($name, $passwd, $uid, $gid, $quota, $comment, $gcos, $dir, X$shell)|. X\medskip X X\table2.4in X Xendpwent XEnds lookup processing. X Xgetpwent XGets next info. X Xgetpwnam(<NAME>) XGets info by name. X Xgetpwuid(<UID>) XGets info by uid. X Xsetpwent XResets lookup processing. X\endtable X X\text \medskip X|/etc/group|. XInfo is a 4-item array: |($name, $passwd, $gid, $members)|. X\medskip X\table2.4in X Xendgrent XEnds lookup processing. X Xgetgrgid(<GID>) XGets info by group id. X Xgetgrnam(<NAME>) XGets info by name. X Xgetgrent XGets next info. X Xsetgrent XResets lookup processing. X\endtable X X\text \medskip X|/etc/hosts|. XInfo is |($name, $aliases, $addrtype, $length, @addrs)|. X\medskip X X\table2.4in X Xendhostent XEnds lookup processing. X Xgethostbyname(<NAME>) XGets info by name. X Xgethostent XGets next info. X Xsethostent(<STAYOPEN>) XResets lookup processing. X\endtable X X\text\medskip X|/etc/networks|. XInfo is |($name, $aliases, $addrtype, $net)|. X\medskip X X\table2.4in X Xendnetent XEnds lookup processing. X Xgetnetbyaddr(<ADDR>,<TYPE>) XGets info by address and type. X Xgetnetbyname(<NAME>) XGets info by name. X Xgetnetent XGets next info. X Xsetnetent(<STAYOPEN>) XResets lookup processing. X\endtable X X\text\medskip X|/etc/services|. XInfo is |($name, $aliases, $port, $proto)|. X\medskip X X\table2.4in Xendservent XEnds lookup processing. X Xgetservbyname(<NAME>, <PROTO>) XGets info by name. X Xgetservbyport(<PORT>, <PROTO>) XGets info by port. X Xgetservent XGets next info. X Xsetservent(<STAYOPEN>) XResets lookup processing. X\endtable X X\text\medskip X|/etc/protocols|. XInfo is |($name, $aliases, $proto)|. X\medskip X X\table2.4in X Xendprotoent XEnds lookup processing. X Xgetprotobyname(<NAME>) XGets info by name. X Xgetprotobynumber(<NUMBER>) XGets info by number. X Xgetprotoent XGets next info. X Xsetprotoent(<STAYOPEN>) XResets lookup processing. X\endtable X X\beginsection 21. Regular expressions X X\text XStandard UNIX regular expressions, with the following additions: X\medskip X X\table1.2in X X|(| |)| \| |{| |}| Xdo not have to be escaped with a |\|. X X|+| Xmatches the preceding pattern element one or more times. X X|?| Xmatches zero or one times. X 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 X|\w| Xmatches alphanumeric, including ``|_|'', |\W| matches non-alphanumeric. X X|\b| Xmatches word boundaries, |\B| matches non-boundaries. X X|\s| Xmatches whitespace, |\S| matches non-whitespace. X X|\d| Xmatches numeric, |\D| matches non-numeric. X\endtable X X\text\medskip X|\n|, |\r|, |\f|, |\t| and |\|<NNN> have their usual meaning. X X|\w|, |\s| and |\d| may be used within character classes, |\b| Xdenotes backspace in this context. X X|\1| \dots\ |\9| refer to matched sub-expressions inside the match. X X|$1| \dots\ |$9| can be used to refer to matched sub-expressions outside the Xmatching. X\medskip X X\table1.2in X X|$+| Xreturns whatever the last bracket match matched. X X|$&| Xreturns the entire matched string. X X|$`| Xreturns everything before the matched string. X X|$'| Xreturns everything after the matched string. X\endtable X X\beginsection 22. Formats X X\text Xformat [<NAME>] = \hfil\break X<FORMLIST> \hfil\break X|.| X X<FORMLIST> pictures the lines, and contains the arguments which will Xgive values to the fields in the lines. Picture fields are: X X\table1in X X|@<<<|\dots Xleft adjusted field, the ``|<|'' is repeated to denote the Xlength of the field; X X|@>>>|\dots Xright adjusted field; X X|@|\|\|\|\dots Xcentered field; X X|@*| Xa multi-line field. X\endtable X X\text\medskip X XUse ``|^|'' instead of ``|@|'' for multi-line block filling. X XUse ``|~|'' at the beginning of a line to suppress unwanted empty lines. X XUse ``|~~|'' at the beginning of a line to have this format line repeated Xuntil all fields are exhausted. X XSet |$-| to zero to force a page break. X X\beginsection 23. Special variables X X\text XThe following variables are global and should be localized in subroutines: X\medskip X X\table.25in X X|$_| XThe default input and pattern-searching space. X X|$.| XThe current input line number of the last filehandle that was read. X X|$/| XThe input record separator, newline by default. X X|$,| XThe output field separator for the print operator. X X|$"| XThe separator which joins elements of arrays interpolated in X strings. X X|$\| XThe output record separator for the print operator. X X|$#| XThe output format for printed numbers. Initial value is ``|%.20g|''. X X|$*| XSet to 1 to do multiline matching within a string, 0 to assume Xstrings contain a single line. Default is 0. X X|$?| XThe status returned by the last backtick (|`|\thinspace|`|) command, Xpipe close or system operator. X X|$]| XThe perl version string as displayed with ``|perl -v|''. X X|$[| XThe index of the first element in an array, and of the first character Xin a substring. Default is 0. X X|$;| XThe subscript separator for multi-dimensional array emulation. XDefault is |"\034"|. X 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 X|$@| XThe perl error message from the last eval or ``do <EXPR>'' command. X X|$:| XThe set of characters after which a string may be broken to fill Xcontinuation fields (starting with ``|^|'') in a format. X X|$0| XThe name of the file containing the perl script being executed. X X|$$| XThe process number of the perl running this script. Altered (in the Xchild process) by fork(). X X|$<| XThe real uid of this process. X X|$>| XThe effective uid of this process. X X|$(| XThe real gid of this process. X X|$)| XThe effective gid of this process. X\endtable X X\text \medskip XThe following variables are context dependent and need not be localized: X\medskip X X\table.25in X X|$%| XThe current page number of the currently selected output channel. X X|$=| XThe page length of the current output channel. Default is 60 lines. X X|$-| XThe number of lines left on the page. X X|$~| XThe name of the current report format. X X|$^| XThe name of the current top-of-page format. X 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 X|$`| XThe string preceding what was matched by the last pattern match. X X|$'| XThe string following what was matched by the last pattern match. X X|$+| XThe last bracket matched by the last search pattern. X X|$1| \dots\ |$9| XContains the subpattern from the corresponding set of parentheses Xin the last pattern matched. X\endtable X X\beginsection 24. Special arrays X X\table.5in X X|@ARGV| XContains the command line arguments for the script (not Xincluding the command name). See |$0| for the command Xname. X X|@INC| XContains the list of places to look for perl scripts to be Xevaluated by the ``do <EXPR>'' command. X X|@_| XParameter array for subroutines. Also used by split if not in Xarray context. X X|%ENV| XContains the current environment. X X|%SIG| XUsed to set signal handlers for various signals. X\endtable X X\beginsection 25. The perl debugger (invoked with {\tt perl -d}) X X\table1.5in X X|h| XPrints out a help message. X X|s| XSingle steps. X X|c| XContinues (until breakpoint or exit). X X\cstok{RET} XRepeats last ``|s|'' or ``|n|''. X X|n| XSingle steps around subroutine call. X 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|''. X X|L| XLists lines that have breakpoints or actions. X X|t| XToggles trace mode. X X|b| [<LINE>] XSets breakpoint at (current) line. X X|b| <SUBNAME> XSets breakpoint at the subroutine. X X|S| XLists names of all subroutines. X X|d| <LINE> XDeletes breakpoint at the given line. X X|D| XDeletes all breakpoints. X X|A| XDeletes all line actions. X X|V| [<PACKAGE>] XLists all variables in a package. Default package is main. X X|a| <LINE> <COMMAND> XSets an action for line. X X|<| <COMMAND> XSets an action to be executed before every debugger prompt. X X|>| <COMMAND> XSets an action to be executed before every ``|s|'', ``|c|'' or ``|n|'' Xcommand. X X|!| [ [|-|]<NUMBER>] XRedo a debugging command. Default is previous command. X X|H| [|-|<NUMBER>] XDisplays the last |-|number commands of more than one letter. X X|q| XQuits. You may also use your \cstok{EOF} character. X X<COMMAND> XExecutes command as a perl statement. X X|p| <EXPR>\* XPrints <EXPR>. X\endtable X X\end X 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 fi 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" -------------------------