home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume28 / perlref / part03 < prev    next >
Encoding:
Text File  |  1992-02-25  |  50.7 KB  |  1,772 lines

  1. Newsgroups: comp.sources.misc
  2. From: jv@mh.nl (Johan Vromans)
  3. Subject:  v28i079:  perlref - Perl Reference Guide 4.019.1 [LaTeX and Postscript], Part03/03
  4. Message-ID: <1992Feb26.175901.25635@sparky.imd.sterling.com>
  5. X-Md4-Signature: e72592e610c148d01f42310f0835e3c5
  6. Date: Wed, 26 Feb 1992 17:59:01 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: jv@mh.nl (Johan Vromans)
  10. Posting-number: Volume 28, Issue 79
  11. Archive-name: perlref/part03
  12. Environment: Perl, Postscript, Latex
  13.  
  14. #!/bin/sh
  15. # do not concatenate these parts, unpack them in order with /bin/sh
  16. # file refbase.sty continued
  17. #
  18. if test ! -r _shar_seq_.tmp; then
  19.     echo 'Please unpack part 1 first!'
  20.     exit 1
  21. fi
  22. (read Scheck
  23.  if test "$Scheck" != 3; then
  24.     echo Please unpack part "$Scheck" next!
  25.     exit 1
  26.  else
  27.     exit 0
  28.  fi
  29. ) < _shar_seq_.tmp || exit 1
  30. if test ! -f _shar_wnt_.tmp; then
  31.     echo 'x - still skipping refbase.sty'
  32. else
  33. echo 'x - continuing file refbase.sty'
  34. sed 's/^X//' << 'SHAR_EOF' >> 'refbase.sty' &&
  35. %
  36. %%%%%%%%%%%%%%%% Macros %%%%%%%%%%%%%%%%
  37. %
  38. \chardef\other=12
  39. %
  40. % |lit| is used to represent literal things.
  41. % Representation is a fixed font.
  42. {\catcode`\|=\active
  43. \gdef|{\leavevmode%
  44. \begingroup\catcode`\\=\other\catcode`\{=\other%
  45. \catcode`\}=\other\catcode`\$=\other\catcode`\&=\other%
  46. \catcode`\#=\other\catcode`\~=\other%
  47. \catcode`\_=\other\catcode`\^=\other\catcode`\<=\other%
  48. \catcode`\[=\other%
  49. \obeyspaces\obeylines%
  50. \let|=\endgroup\escapechar`\|\catcode`\%=\other\tt}}
  51. \catcode`\|=\active
  52. X
  53. % <var> is used for variable things. 
  54. % Representation is 10pt sans-serif uppercased.
  55. \catcode`\<=\active
  56. \def<{\leavevmode\italicizerest}
  57. \def\italicizerest#1>{{\small\sf\uppercase{#1}}}
  58. X
  59. % LaTeX active and 'hot' characters
  60. \def\|{\leavevmode\hbox{\tt\char`\|}}
  61. \def\<{\leavevmode\hbox{\tt\char`\<}}
  62. \def\>{\leavevmode\hbox{\tt\char`\>}}
  63. \def\^{\leavevmode\hbox{\tt\char`\^}}
  64. \def\${\leavevmode\hbox{\tt\char`\$}}
  65. \def\%{\leavevmode\hbox{\tt\char`\%}}
  66. \def\&{\leavevmode\hbox{\tt\char`\&}}
  67. \def\{{\leavevmode\hbox{\tt\char`\{}}
  68. \def\}{\leavevmode\hbox{\tt\char`\}}}
  69. \def\_{\leavevmode\hbox{\tt\char`\_}}
  70. X
  71. % Keywords
  72. % Representation is 10pt sans-serif bold.
  73. \def\kwd#1{{\small\bf #1}}
  74. X
  75. % Definitions
  76. \def\oEXPR{<expr>\dag}
  77. X
  78. %%%%%%%%%%%%%%%% Enumerations %%%%%%%%%%%%%%%%
  79. %
  80. % Usage:
  81. %
  82. %  \begin{enum}{width}
  83. %  \Xi{Blah} blah blah...
  84. %  \Xi{Blah} bla ...
  85. %  ...
  86. %  \end{enum}
  87. %
  88. \newlength{\@xli}
  89. \newlength{\@xlj}
  90. \def\enum#1{
  91. X    \list{}{
  92. X      \setlength{\topsep}{0pt plus 1pt}
  93. X      \setlength{\partopsep}{0pt plus 1pt}
  94. X      \setlength{\itemsep}{0pt plus 1pt}
  95. X      \setlength{\parsep}{\parskip}
  96. X      \setlength{\itemindent}{0pt}
  97. X      \setlength{\labelsep}{5pt}
  98. X      \setlength{\labelwidth}{#1}
  99. X      \setlength{\leftmargin}{\labelwidth}
  100. X      \addtolength{\labelwidth}{-\labelsep}
  101. X      \setlength{\@xli}{\labelwidth}
  102. X      \def\makelabel##1{##1\hss}}}
  103. X
  104. % List element that overflows if it is too wide
  105. \def\Xi#1{
  106. X    \settowidth{\@xlj}{#1}
  107. X    \item[{#1}]
  108. X    \ifnum\@xlj>\@xli
  109. X           \strut\newline
  110. X    \fi}
  111. % List element that does not overflow if it is too wide
  112. \def\Xj#1{\item[#1]}
  113. X
  114. \let\endenum=\endlist
  115. X
  116. %%%%%%%%%%%%%%%% Emacs support %%%%%%%%%%%%%%%%
  117. %
  118. % Local Variables:
  119. % eval:(auto-fill-mode 0)
  120. % eval:(headers)
  121. % eval:(setq comment-start "% ")
  122. % eval:(setq comment-start-skip "% +")
  123. % End:
  124. SHAR_EOF
  125. echo 'File refbase.sty is complete' &&
  126. chmod 0444 refbase.sty ||
  127. echo 'restore of refbase.sty failed'
  128. Wc_c="`wc -c < 'refbase.sty'`"
  129. test 6963 -eq "$Wc_c" ||
  130.     echo 'refbase.sty: original size 6963, current size' "$Wc_c"
  131. rm -f _shar_wnt_.tmp
  132. fi
  133. # ============= refbase.tex ==============
  134. if test -f 'refbase.tex' -a X"$1" != X"-c"; then
  135.     echo 'x - skipping refbase.tex (File already exists)'
  136.     rm -f _shar_wnt_.tmp
  137. else
  138. > _shar_wnt_.tmp
  139. echo 'x - extracting refbase.tex (Text)'
  140. sed 's/^X//' << 'SHAR_EOF' > 'refbase.tex' &&
  141. \def\revision{1}
  142. \documentstyle{refbase}
  143. X
  144. \begin{document}
  145. X
  146. X
  147. \begin{titlepage}
  148. X
  149. \hbox{ }
  150. \end{titlepage}
  151. X
  152. \begin{titlepage}
  153. \addtolength{\evensidemargin}{2cm}
  154. \addtolength{\textwidth}{-2.1cm}
  155. \vspace*{2.5cm}
  156. X
  157. \unnumbered{Perl Reference Guide}
  158. {\bf for Perl version \perlrev}
  159. X
  160. \vskip1cm
  161. Perl program designed and created by \\
  162. Larry Wall \<lwall@netlabs.com\>
  163. X
  164. \vskip1cm
  165. Reference guide designed and created by \\
  166. Johan Vromans \<jv@mh.nl\>
  167. X
  168. \vskip1.5cm
  169. \unnumbered{Contents}
  170. X
  171. \newcounter{xx}
  172. \begin{list}{\thexx.}
  173. {\setlength{\topsep}{0pt plus 1pt}
  174. X \setlength{\itemsep}{0pt plus 1pt}
  175. X \setlength{\parsep}{0pt plus 1pt}
  176. X \usecounter{xx}}
  177. \item Command line options
  178. \item Literals
  179. \item Variables
  180. \item Statements
  181. \item Flow control
  182. \item Operators
  183. \item File test operators
  184. \item Arithmetic functions
  185. \item Conversion functions
  186. \item Structure conversion
  187. \item String functions
  188. \item Array and list functions
  189. \item File operations
  190. \item Directory reading routines
  191. \item Input / Output
  192. \item Search and replace functions
  193. \item System interaction
  194. \item Networking
  195. \item SystemV IPC
  196. \item Miscellaneous
  197. \item Formats
  198. \item Info from system files
  199. \item Regular expressions
  200. \item Special variables
  201. \item Special arrays
  202. \item The perl debugger
  203. \end{list}
  204. \vskip1cm
  205. {\catcode`\%=\other \small {Rev. \refrev}}
  206. \end{titlepage}
  207. X
  208. \unnumbered{Conventions}
  209. X
  210. \begin{enum}{2cm}
  211. \Xi{|fixed|} denotes literal text.
  212. X
  213. \Xi{<this>} means variable text, i.e. things you must fill in.
  214. X
  215. \Xi{<this>\dag} means that <this> will default to |$_| if omitted.
  216. X
  217. \Xi{\kwd{word}} is a keyword, i.e. a word with a special meaning.
  218. X
  219. \Xi{\fbox{<ret>}} denotes pressing a keyboard key.
  220. X
  221. \Xi{[\ldots]} denotes an optional part.
  222. X
  223. \Xi{(\ldots)*} means that the parentheses may be omitted.
  224. X
  225. \end{enum}
  226. X
  227. X
  228. \section{Command line options} 
  229. X
  230. \begin{enum}{1cm}
  231. X
  232. \Xi{|-a|} turns on autosplit mode when used with |-n| or
  233. |-p|. Splits to |@F|.
  234. X
  235. \Xi{|-c|} checks syntax but does not execute.
  236. X
  237. \Xi{|-d|} runs the script under the debugger. Use |-de 0| to
  238. start the debugger without a script.
  239. X
  240. \Xi{|-D| <number>} sets debugging flags. 
  241. X
  242. \Xi{|-e| <commandline>} may be used to enter one line of
  243. script. Multiple |-e| commands may be given to build up a
  244. multi-line script.
  245. X
  246. \Xi{|-i| <ext>} files processed by the |<>| construct are
  247. to be edited in-place.
  248. X
  249. \Xi{|-I| <dir>} with |-P|: tells the C preprocessor where
  250. to look for include files. The directory is prepended to |@INC|.
  251. X
  252. \Xi{|-L| <octnum>} enables automatic line ending processing.
  253. X
  254. \Xi{|-n|} assumes an input loop around your script. Lines are not
  255. printed.
  256. X
  257. \Xi{|-p|} assumes an input loop around your script. Lines are
  258. printed.
  259. X
  260. \Xi{|-P|} runs the C preprocessor on the script before
  261. compilation by perl.
  262. X
  263. \Xi{|-s|} interprets ``|-xxx|'' on the command line as
  264. switches and sets the corresponding variables \$|xxx| in the script.
  265. X
  266. \Xi{|-S|} uses the |PATH| environment variable to search for
  267. the script.
  268. X
  269. \Xi{|-u|} dumps core after compiling the script. To be used with
  270. the {\it undump\/} program (where available).
  271. X
  272. \Xi{|-U|} allows perl to do unsafe operations.
  273. X
  274. \Xi{|-v|} prints the version and patchlevel of your perl
  275. executable.
  276. X
  277. \Xi{|-w|} prints warnings about possible spelling errors and
  278. other error-prone constructs in the script.
  279. X
  280. \Xi{|-x|} extracts perl program from input stream.
  281. X
  282. \Xi{|-0| <val>} (that's the number zero) designates an
  283. initial value for the record terminator \$|/|.
  284. See also |-L|.
  285. X
  286. \end{enum}
  287. X
  288. \makeuppage
  289. X
  290. \section{Literals} 
  291. X
  292. Numeric: |123  123.4  5E-10  0xff| (hex)|  0377| (octal).
  293. X
  294. \hangindent=2cm\hangafter=1
  295. String: |'abc'| literal string, no variable interpolation nor
  296. escape characters.
  297. \newline Also: |q/abc/|.
  298. \newline (Almost any pair of delimiters can be used instead of |/.../|.)
  299. X
  300. \hangindent=2cm\hangafter=1
  301. \makebox[1cm]{}|"abc"|
  302. Variables are interpolated and escape sequences are processed. 
  303. \newline Also: |qq/abc/|.
  304. \newline Escape sequences: |\t| (Tab), |\n| (Newline), |\r| (Return),
  305. |\f| (Formfeed), |\b| (Backspace), |\a| (Alarm), |\e|
  306. (Escape), |\033|(octal), |\x1b|(hex), |\c[| (control).
  307. \newline |\l| and |\u| lowcase/upcase the following character; 
  308. \newline |\L| and |\U| lowcase/upcase until a |\E| is encountered.
  309. X
  310. X
  311. \hangindent=2cm\hangafter=1
  312. \makebox[1cm]{}|`|<command>|`|
  313. evaluates to the output of the <command>. 
  314. \newline Also: |qx/|<command>|/|.
  315. X
  316. \hangindent=1cm\hangafter=1
  317. Array: |(1,2,3)|. |()| is an empty array.  
  318. \newline Also: |($a,$b,@rest) = (1,2,...);|
  319. \newline |(1..4)| is the same as |(1,2,3,4)|. Likewise |('abc'..'ade')|
  320. X
  321. \hangindent=1cm\hangafter=1
  322. Associative array:
  323. |(|<key1>|,|<val1>|,|<key2>|,|<val2>|,...)|
  324. X
  325. \hangindent=1cm\hangafter=1
  326. Filehandles: 
  327. \newline Pre-defined: |<STDIN>|, |<STDOUT>|, |<STDERR>|, |<ARGV>|,
  328. |<DATA>|;
  329. \newline User-specified: |<|<handle>|>|, |<$|<var>|>|.
  330. \newline |<>| is the input stream formed by the files specified in
  331. |@ARGV|, or standard input if no arguments are supplied.
  332. X
  333. \hangindent=1cm\hangafter=1
  334. Globs: |<|<pattern>|>| evaluates to all filenames according
  335. to the pattern.
  336. \newline Use |<${|<var>|}>| to glob from a variable.
  337. X
  338. \hangindent=1cm\hangafter=1
  339. Here-Is: |<<|<identifier>
  340. \newline {\it See the manual for details.}
  341. X
  342. \hangindent=1cm\hangafter=1
  343. Special tokens:
  344. \newline \_\,\_|FILE|\_\,\_: filename; \_\,\_|LINE|\_\,\_: line number.
  345. \newline \_\,\_|END|\_\,\_: end of program; remaining lines can be read using
  346. \<<data>\>.
  347. X
  348. X
  349. \section{Variables} 
  350. X
  351. \begin{enum}{3.2cm}
  352. X
  353. \Xi{|\$var|} a simple scalar variable
  354. X
  355. \Xi{|\$var[28]|} 29th element of array |@var| (the |[]| are
  356. part of it)
  357. X
  358. \Xi{|\$var\{'Feb'\}|} one value from associative array |%var|
  359. X
  360. \Xi{|\$\#var|} last index of array |@var|
  361. X
  362. \Xi{|@var|} the entire array;
  363. \\
  364. in scalar context: the number of elements in the array
  365. X
  366. \Xi{|@var[3,4,5]|} a slice of the array |@var|
  367. X
  368. \Xi{|@var\{'a','b'\}|} a slice of |%var|; same as
  369. |($var{'a'},$var{'b'})|
  370. X
  371. \Xi{|\%var|} the entire associative array;
  372. \\
  373. in scalar context: TRUE if the array has elements
  374. X
  375. \Xj{|\$var\{'a',1,...\}|} emulates a multi-dimensional array
  376. X
  377. \Xi{|('a'..'z')[4,7,9]|} a slice of an array literal
  378. X
  379. \Xi{|*|<name>} refers to all objects represented by <name>.
  380. ``|*name1 = *name2|'' makes |name1| a reference to |name2|.
  381. X
  382. \end{enum}
  383. X
  384. X
  385. \section{Statements} 
  386. X
  387. Every statement is an expression, optionally followed by a modifier,
  388. and terminated by a semi-colon.
  389. X
  390. Execution of expressions can depend on other expressions using one of
  391. the modifiers \kwd{if}, \kwd{unless}, \kwd{while} or \kwd{until},
  392. e.g.:
  393. X
  394. \quad    <expr1> \kwd{if} <expr2> |;| \\
  395. \quad    <expr1> \kwd{until} <expr2> |;|
  396. X
  397. Also, by using one of the logical operators \|\|, |&&| or |? :|, e.g.:
  398. X
  399. \quad    <expr1> \|\| <expr2> |;| \\
  400. \quad    <expr1> |?| <expr2> |:| <expr3> |;| 
  401. X
  402. Statements can be combined to form a <block> when enclosed in |{}|.
  403. X
  404. Compound statements may be used to control flow:
  405. X
  406. \quad    \kwd{if} |(|<expr>|)| <block> [ [ \kwd{elsif}
  407. X    |(|<expr>|)| <BLOCK ...> ] \kwd{else}
  408. X    <block> ]
  409. \\
  410. \quad    \kwd{unless} |(|<expr>|)| <block> [ \kwd{else}
  411. X    <block> ]
  412. \\
  413. \quad    [ <label>\kwd{:} ] \kwd{while} |(|<expr>|)|
  414. X    <block> [ \kwd{continue} <block> ]
  415. \\
  416. \quad    [ <label>\kwd{:} ] \kwd{until} |(|<expr>|)|
  417. X    <block> [ \kwd{continue} <block> ]
  418. \\
  419. \quad    [ <label>\kwd{:} ] \kwd{for} |(|<expr>|;|
  420. X    <expr>|;| <expr>|)| <block>
  421. \\
  422. \quad    [ <label>\kwd{:} ] \kwd{foreach} <var>\dag
  423. X    |(|<array>|)| <block>
  424. \\
  425. \quad    [ <label>\kwd{:} ] <block> [ \kwd{continue} < block> ]
  426. X
  427. Special forms are:
  428. X
  429. \quad    \kwd{do} <block> \kwd{while} <expr> |;| \\
  430. \quad    \kwd{do} <block> \kwd{until} <expr> |;| \\
  431. X
  432. which are guaranteed to perform <block> once before testing <expr>.
  433. X
  434. X
  435. X
  436. \section{Flow control} 
  437. X
  438. \begin{enum}{1cm}
  439. X
  440. \Xi{\kwd{do} <block>}
  441. Returns the value of the last command in the sequence of commands indicated by <block>. \kwd{next}, \kwd{last} and \kwd{redo}
  442. X cannot be used here.
  443. X
  444. \Xi{\kwd{do} <subroutine>\kwd{(LIST)}} 
  445. Executes a <subroutine> declared by a \kwd{sub} declaration, and
  446. returns the value of the last expression evaluated in <subroutine> .
  447. \newline Preferred form is: |&|<subroutine> .
  448. X
  449. \Xi{\kwd{do} <FILENAME>}
  450. Executes the contents of <filename> as a perl script. Errors are
  451. returned in |$@|.
  452. \newline Preferred form is: \kwd{require} <filename> .
  453. X
  454. \Xi{\kwd{goto} <label>}
  455. Continue execution at the specified label.
  456. X
  457. \Xi{\kwd{last} [<label>]}
  458. Immediately exits the loop in question. Skips continue block.
  459. X
  460. \Xi{\kwd{next} [<label>]}
  461. Starts the next iteration of the loop.
  462. X
  463. \Xi{\kwd{redo} [<label>]}
  464. Restarts the loop block without evaluating the conditional again.
  465. X
  466. \Xi{\kwd{return} <expr>}
  467. Returns from a subroutine with the value specified.
  468. X
  469. \end{enum}
  470. X
  471. X
  472. \section{Operators} 
  473. X
  474. \begin{tabbing}
  475. |    |\=|    |\= \kill
  476. |+ -| \> |* /| \> Addition, subtraction, multiplication, division. \\
  477. |%| \> \> Modulo division. \\
  478. \| \& \> \^ \> Bitwise or, bitwise and, bitwise exclusive or. \\
  479. |>>| \> |<<| \> Bitwise shift right, bitwise shift left. \\
  480. |**| \> \> Exponentiation. \\
  481. |.| \> \> Concatenation of two strings. \\
  482. \kwd{x} \> \> Returns a string or array consisting of the left operand
  483. (an array or \\
  484. \> \> a string) repeated the number of times specified by the right operand.
  485. \end{tabbing}
  486. X
  487. All of the above operators also have an assignment operator, e.g. ``|.=|''.
  488. X
  489. \begin{tabbing}
  490. |    |\=|    |\= \kill
  491. |++| \> |--| \> Auto-increment (magical on strings), auto-decrement. \\
  492. |? :|\>      \> Alternation (if-then-else) operator. \\
  493. \|\| \> \&\&   \> Logical or, logical and. \\
  494. |=|\,|=| \> |!=| \> Numeric equality, inequality. \\
  495. \kwd{eq} \> \kwd{ne} \> String equality, inequality. \\
  496. |<|  \>  |>|  \> Numeric less than, greater than. \\
  497. \kwd{lt} \> \kwd{gt} \> String less than, greater than. \\
  498. |<=| \> |>=| \> Numeric less (greater) than or equal to. \\
  499. \kwd{le} \> \kwd{ge} \> String less (greater) than or equal. \\
  500. |<=>| \> \> Numeric compare. Returns -1, 0 or 1. \\
  501. \kwd{cmp} \> \> String compare. Returns -1, 0 or 1. \\
  502. |=~| \> |!~| \> Search pattern, substitution, or translation (negated). \\
  503. |..| \> \> Enumeration, also input line range operator. \\
  504. |,| \> \> Comma operator.
  505. \end{tabbing}
  506. X
  507. X
  508. \section{File test operators} 
  509. X
  510. These unary operators takes one argument, either a filename or a
  511. filehandle, and tests the associated file to see if something is true
  512. about it. If the argument is omitted, tests |$_| (except for |-t,|
  513. which tests |STDIN|). If the special argument |_| (underscore) is
  514. passed, uses the info of the preceding test. 
  515. X
  516. \begin{enum}{2.5cm}
  517. X
  518. \Xi{|-r -w -x -o|}  File is readable/writable/executable/owned by
  519. effective uid. 
  520. X
  521. \Xi{|-R -W -X -O|}  File is readable/writable/executable/owned by real
  522. uid.  
  523. X
  524. \Xi{|-e  -z  -s|}  File exists / has zero/non-zero size. 
  525. X
  526. \Xi{|-f  -d|}  File is a plain file, a directory.
  527. X
  528. \Xi{|-l  -S  -p|}  File is a symbolic link, a socket, a named pipe (FIFO). 
  529. X
  530. \Xi{|-b  -c|}  File is a block/character special file. 
  531. X
  532. \Xi{|-u  -g  -k|}  File has setuid/setgid/sticky bit set. 
  533. X
  534. \Xi{|-t|}  Tests if filehandle (|STDIN| by default) is opened to a tty.
  535. X
  536. \Xi{|-T  -B|}  File is a text/non-text (binary) file.  |-T| and |-B|
  537. return TRUE on a null file, or a file at EOF when testing a filehandle. 
  538. X
  539. \Xi{|-M  -A  -C|}  File creation / access / inode change time. Measured
  540. in days since this program started. See also |$^T| in section
  541. ``Special~Variables''.
  542. X
  543. \end{enum}
  544. X
  545. \makeuppage
  546. X
  547. A <list> is a (possibly parenthesised) list of expressions, variables
  548. or <list>s. An array variable or an array slice may always be used
  549. instead of a <list>.  
  550. X
  551. \section{Arithmetic functions} 
  552. X
  553. \begin{enum}{1cm}
  554. X
  555. \Xi{\kwd{atan2(}<y>\kwd{,}<x>\kwd{)}}
  556. Returns the arctangent of <Y>/<X> in the range -$\pi$ to $\pi$.
  557. X
  558. \Xi{\kwd{cos(}\oEXPR \kwd{)}*}
  559. Returns the cosine of <expr> (expressed in radians).
  560. X
  561. \Xi{\kwd{exp(}\oEXPR \kwd{)}*}
  562. Returns |e| to the power of <expr>.
  563. X
  564. \Xi{\kwd{int(}\oEXPR \kwd{)}*}
  565. Returns the integer portion of <expr>.
  566. X
  567. \Xi{\kwd{log(}\oEXPR \kwd{)}*}
  568. Returns natural logarithm (base |e|) of <expr>.
  569. X
  570. \Xi{\kwd{rand}[\kwd{(}<expr>\kwd{)}*]}
  571. Returns a random fractional number between 0 and the value of <expr>.
  572. If <expr> is omitted, returns a value between 0 and 1. 
  573. X
  574. \Xi{\kwd{sin(}\oEXPR \kwd{)}*}
  575. Returns the sine of <expr> (expressed in radians).
  576. X
  577. \Xi{\kwd{sqrt(}\oEXPR \kwd{)}*}
  578. Return the square root of <expr>.
  579. X
  580. \Xi{\kwd{srand}[\kwd{(}<expr>\kwd{)}*]}
  581. Sets the random number seed for the rand operator.
  582. X
  583. \Xi{\kwd{time}}
  584. Returns the number of seconds since January 1, 1970. Suitable for
  585. feeding to \kwd{gmtime} and \kwd{localtime}. 
  586. X
  587. \end{enum}
  588. X
  589. X
  590. \section{Conversion functions} 
  591. X
  592. \begin{enum}{1cm}
  593. X
  594. \Xi{\kwd{gmtime(}<expr>\kwd{)}*}
  595. Converts a time as returned by the \kwd{time} function to a 9-element
  596. array (\$sec, \$min, \$hour, \$mday, \$mon, \$year, \$wday,
  597. \$yday, \$isdst) with the time analyzed for the Greenwich timezone.
  598. \$mon has the range 0..11 and \$wday has the range 0..6.
  599. X
  600. \Xi{\kwd{hex(}\oEXPR\kwd{)}*}
  601. Returns the decimal value of <expr> interpreted as an hex string.
  602. X
  603. \Xi{\kwd{localtime(}<expr>\kwd{)}*}
  604. Converts a time as returned by the \kwd{time} function to a 9-element
  605. array with the time analyzed for the local timezone. 
  606. X
  607. \Xi{\kwd{oct(}\oEXPR\kwd{)}*}
  608. Returns the decimal value of <expr> interpreted as an octal string. If
  609. <expr> starts off with |0x|, interprets it as a hex string instead.
  610. X
  611. \Xi{\kwd{ord(}\oEXPR\kwd{)}*}
  612. Returns the ascii value of the first character of <expr>.
  613. X
  614. \Xi{\kwd{vec(}<expr>\kwd{,}<offset>\kwd{,}<bits>\kwd{)}}
  615. Treats <expr> as a string of unsigned ints, and yields the bit at
  616. <offset>. <bits> must be between 1 and 32. May be used as an lvalue.
  617. X
  618. \end{enum}
  619. X
  620. X
  621. \section{Structure conversion} 
  622. X
  623. \begin{enum}{1cm}
  624. X
  625. \Xi{\kwd{pack(}<template>\kwd{,}<list>\kwd{)}}
  626. Packs the values into a binary structure using <template>.
  627. X
  628. \Xi{\kwd{unpack(}<template>\kwd{,}<expr>\kwd{)}}
  629. Unpacks the structure <expr> into an array, using <template>.
  630. X
  631. <template> is a sequence of characters as follows:
  632. X
  633. \begin{tabbing}
  634. |  |\=|a |\=|/ |\=|A  |\= \kill
  635. X  \> |a| \> / \> |A| \> Ascii string, null / space padded \\
  636. X  \> |b| \> / \> |B| \> Bit string in ascending / descending order \\
  637. X  \> |c| \> / \> |C| \> Native / unsigned char value \\
  638. X  \> |f| \> / \> |d| \> Single / double float in native format \\
  639. X  \> |h| \> / \> |H| \> Hex string, low / high nybble first. \\
  640. X  \> |i| \> / \> |I| \> Signed / unsigned integer value \\
  641. X  \> |l| \> / \> |L| \> Signed / unsigned long value \\
  642. X  \> |n| \> / \> |N| \> Short / long in network byte order \\
  643. X  \> |s| \> / \> |S| \> Signed / unsigned short value \\
  644. X  \> |u| \> / \> |p| \> Uuencoded string / Pointer to a string \\
  645. X  \> |x| \> / \> |@| \> Null byte / null fill until position \\
  646. X  \> |X| \>   \>     \> Backup a byte
  647. \end{tabbing}
  648. X
  649. Each character may be followed by a decimal number which will be used
  650. as a repeat count, an |*| specifies all remaining arguments. \\
  651. If the format is preceded with |%|<n>, \kwd{unpack} returns an
  652. <n>-bit checksum instead. \\
  653. Spaces may be included in the template for readability purposes.
  654. X
  655. \end{enum}
  656. X
  657. X
  658. \section{String functions} 
  659. X
  660. \begin{enum}{1cm}
  661. X
  662. \Xi{\kwd{chop(}<list>\dag\kwd{)}}
  663. Chops off the last character on all elements of the list; returns the
  664. last chopped character. The parentheses may be omitted if <list> is a
  665. single variable.
  666. X
  667. \Xi{\kwd{crypt(}<plaintext>\kwd{,}<salt>\kwd{)}}
  668. Encrypts a string.
  669. X
  670. \Xi{\kwd{eval(}\oEXPR \kwd{)}*}
  671. <expr> is parsed and executed as if it were a perl program. The value
  672. returned is the value of the last expression evaluated. If there is a
  673. syntax error or runtime error, an undefined string is returned by
  674. \kwd{eval}, and |$@| is set to the error message.
  675. X
  676. \Xi{\kwd{eval\{}<expr>\kwd{;...\}}}
  677. Executes the code between \{ and \}. Traps run-time errors as described
  678. above.
  679. X
  680. \Xi{\kwd{index(}<str>\kwd{,}<substr>[\kwd{,}<offset>]\kwd{)}}
  681. Returns the position of <substr> in <str> at or after <offset>. If the
  682. substring is not found, returns |$[-1|.
  683. X
  684. \Xi{\kwd{length(}\oEXPR\kwd{)}*}
  685. Returns the length in characters of the value of <expr>.
  686. X
  687. \Xi{\kwd{rindex(}<str>\kwd{,}<substr>[\kwd{,}<offset>]\kwd{)}}
  688. Returns the position of the last occurrence of <substr> in <str> at or
  689. before <offset>.
  690. X
  691. \Xi{\kwd{substr(}<expr>\kwd{,}<offset>[\kwd{,}<len>]\kwd{)}}
  692. Extracts a substring out of <expr> and returns it. If <offset>
  693. is negative, counts from the end of the string. May be used as an lvalue.
  694. X
  695. \end{enum}
  696. X
  697. X
  698. \section{Array and list functions} 
  699. X
  700. \begin{enum}{1cm}
  701. X
  702. \Xi{\kwd{delete} \$<array>\{<key>\}}
  703. Deletes the specified value from the specified associative array.
  704. Returns the deleted value. 
  705. X
  706. \Xi{\kwd{each(}|\%|<array>\kwd{)}*}
  707. Returns a 2-element array consisting of the key and value for the next
  708. value of an associative array. Entries are returned in an apparently
  709. random order. When the array is entirely read, a null array is
  710. returned. The next call to \kwd{each} after that will start iterating again.
  711. X
  712. \Xi{\kwd{grep(}<expr>\kwd{,}<list>\kwd{)}}
  713. Evaluates <expr> for each element of the <list>, locally setting |$_|
  714. to refer to the element. Modifying |$_| will modify the corresponding
  715. element from <list>. Returns array of elements from <list> for which
  716. <expr> returned true. 
  717. X
  718. \Xi{\kwd{join(}<expr>\kwd{,}<list>\kwd{)}}
  719. Joins the separate strings of <list> into a single string with fields
  720. separated by the value of <expr>, and returns the string.
  721. X
  722. \Xi{\kwd{keys(}|\%|<array>\kwd{)}*}
  723. Returns an array with of all the keys of the named
  724. associative array.
  725. X
  726. \Xi{\kwd{pop(}|@|<array>\kwd{)}*}
  727. Pops and returns the last value of the array, shortens the array by 1. 
  728. X
  729. \Xi{\kwd{push(}|@|<array>\kwd{,}<list>\kwd{)}}
  730. Pushes the values of <list> onto the end of <array>. The length of the
  731. array increases by the length of <list>.
  732. X
  733. \Xi{\kwd{reverse(}<list>\kwd{)}*}
  734. In array context: returns the <list> in reverse order. \\
  735. In scalar
  736. context: returns the first element of <list> with bytes reversed. 
  737. X
  738. \Xi{\kwd{scalar(}|@|<array>\kwd{)}}
  739. Returns the number of elements in the array.
  740. X
  741. \Xi{\kwd{scalar(}|\%|<array>\kwd{)}}
  742. Returns TRUE if the associative array has elements defined.
  743. X
  744. \Xi{\kwd{shift}[\kwd{(}|@|<array>\kwd{)}*]}
  745. Shifts the first value of the array off and returns it, shortening the
  746. array by 1 and moving everything down. If |@|<array> is omitted, shifts
  747. |@ARGV| in main and |@_| in subroutines.  
  748. X
  749. \Xi{\kwd{sort(} [<subroutine> ] <list>\kwd{)}*}
  750. Sorts the <list> and returns the sorted array value. If <subroutine>
  751. is specified, gives the name of a subroutine that returns less than
  752. zero, zero, or greater than zero, depending on how the elements of the
  753. array, available to the routine as |$a| and |$b|, are to be ordered.
  754. \\
  755. <SUBROUTINE> may be the name of a user-defined routine, or a <block>
  756. (see ``Statements'' and ``Miscellaneous'').
  757. X
  758. \Xi{\kwd{splice(}|@|<array>\kwd{,}<offset>[\kwd{,}<length>[\kwd{,}<list>]]\kwd{)}}
  759. Removes the elements of |@|<array> designated by <offset> and
  760. <length>, and replaces them with <list> (if specified). \\
  761. Returns the elements removed.
  762. X
  763. \Xi{\kwd{split}[\kwd{(}<pattern>[\kwd{,}\oEXPR [\kwd{,}<limit>]]\kwd{)}]}
  764. Splits a string into an array of strings, and returns it. If <limit>
  765. is specified, splits in no more than that many fields. If <pattern> is
  766. also omitted, splits on whitespace. If
  767. not in array context: returns number of fields and splits to |@_|.
  768. See also: ``Search and Replace Functions''. 
  769. X
  770. \Xi{\kwd{unshift(}|@|<array>\kwd{,}<list>\kwd{)}}
  771. Prepends list to the front of the array, and returns the number of
  772. elements in the new array.
  773. X
  774. \Xi{\kwd{values(}|\%|<array>\kwd{)}*}
  775. Returns a normal array consisting of all the values of the named
  776. associative array. 
  777. X
  778. \end{enum}
  779. X
  780. X
  781. X
  782. X
  783. \section{File operations} 
  784. X
  785. Functions operating on a list of files return the number of files
  786. successfully operated upon.
  787. X
  788. \begin{enum}{1cm}
  789. X
  790. \Xi{\kwd{chmod(}<list>\kwd{)}*}
  791. Changes the permissions of a list of files. The first element of the
  792. list must be the numerical mode. 
  793. X
  794. \Xi{\kwd{chown(}<list>\kwd{)}*}
  795. Changes the owner and group of a list of files. The first two elements
  796. of the list must be the numerical uid and gid. 
  797. X
  798. \Xi{\kwd{truncate(}<file>\kwd{,}<size>\kwd{)}}
  799. truncates <file> to <size>. <file> may be a filename or a filehandle.
  800. X
  801. \Xi{\kwd{link(}<oldfile>\kwd{,}<newfile>\kwd{)}}
  802. Creates a new filename linked to the old filename.
  803. X
  804. \Xi{\kwd{lstat(}<file>\kwd{)}}
  805. Like stat, but does not traverse a final symbolic link.
  806. X
  807. \Xi{\kwd{mkdir(}<dir>\kwd{,}<mode>\kwd{)}}
  808. Creates a directory with given permissions. Sets |$!| on failure.
  809. X
  810. \Xi{\kwd{readlink(}\oEXPR\kwd{)}*}
  811. Returns the value of a symbolic link.
  812. X
  813. \Xi{\kwd{rename(}<oldname>\kwd{,}<newname>\kwd{)}}
  814. Changes the name of a file.
  815. X
  816. \Xi{\kwd{rmdir(}<filename>\dag\kwd{)}*}
  817. Deletes the directory if it is empty. Sets |$!| on failure.
  818. X
  819. \Xi{\kwd{stat(}<file>\kwd{)}}
  820. Returns a 13-element array (\$dev, \$ino, \$mode, \$nlink, \$uid, \$gid,
  821. \$rdev, \$size, \$atime, \$mtime, \$ctime, \$blksize, \$blocks). <file> can
  822. be a filehandle, an expression evaluating to a filename, or |_| to
  823. refer to the last file test operation. 
  824. X
  825. \Xi{\kwd{symlink(}<oldfile>\kwd{,}<newfile>\kwd{)}}
  826. Creates a new filename symbolically linked to the old filename.
  827. X
  828. \Xi{\kwd{unlink(}<list>\kwd{)}*}
  829. Deletes a list of files.
  830. X
  831. \Xi{\kwd{utime(}<list>\kwd{)}*}
  832. Changes the access and modification times. The first two elements of
  833. the list must be the numerical access and modification times.
  834. X
  835. \end{enum}
  836. X
  837. X
  838. X
  839. \makeuppage
  840. X
  841. \section{Directory reading routines} 
  842. X
  843. \begin{enum}{1cm}
  844. X
  845. \Xi{\kwd{closedir(}<dirhandle>\kwd{)}*}
  846. Closes a directory opened by opendir.
  847. X
  848. \Xi{\kwd{opendir(}<dirhandle>\kwd{,}<dirname>\kwd{)}}
  849. Opens a directory on the handle specified.
  850. X
  851. \Xi{\kwd{readdir(}<dirhandle>\kwd{)}*}
  852. Returns the next entry (or an array of entries) in the directory.
  853. X
  854. \Xi{\kwd{rewinddir(}<dirhandle>\kwd{)}*}
  855. Positions the directory to the beginning.
  856. X
  857. \Xi{\kwd{seekdir(}<dirhandle>\kwd{,}<pos>\kwd{)}}
  858. Sets position for readdir on the directory.
  859. X
  860. \Xi{\kwd{telldir(}<dirhandle>\kwd{)}*}
  861. Returns the postion in the directory.
  862. X
  863. \end{enum}
  864. X
  865. X
  866. \section{Input / Output} 
  867. X
  868. In input/output operations, <filehandle> may be a filehandle as opened
  869. by the \kwd{open} operator, or a scalar variable which evaluates to
  870. the name of a filehandle to be used.  
  871. X
  872. \begin{enum}{1cm}
  873. X
  874. \Xi{\kwd{binmode(}<filehandle>\kwd{)}*}
  875. Arranges for the file opened on <filehandle> to be read in ``binary''
  876. mode as opposed to ``text'' mode (MS-DOS only). 
  877. X
  878. \Xi{\kwd{close(}<filehandle>\kwd{)}*}
  879. Closes the file or pipe associated with the file handle.
  880. X
  881. \Xi{\kwd{dbmclose(}|\%|<array>\kwd{)}*}
  882. Breaks the binding between the array and the dbm file.
  883. X
  884. \Xi{\kwd{dbmopen(}|\%|<array>\kwd{,}<dbmname>\kwd{, }<mode>\kwd{)}}
  885. Binds a dbm or ndbm file to the associative array. If the database
  886. does not exist, it is created with the indicated mode. 
  887. X
  888. \Xi{\kwd{eof(}<filehandle>\kwd{)}}
  889. Returns 1 if the next read will return end of file, or if the file is
  890. not open. 
  891. X
  892. \Xi{\kwd{eof}}
  893. Returns the eof status for the last file read.
  894. X
  895. \Xi{\kwd{eof( )}}
  896. Indicates eof on the pseudo file formed of the files listed on the
  897. command line. 
  898. X
  899. \Xi{\kwd{fcntl(}<filehandle>\kwd{,}<function>\kwd{,}|\$|<var>\kwd{)}}
  900. Implements the {\it fcntl\/}(2) function. This function has non-standard
  901. return values. See the manual for details. 
  902. X
  903. \Xi{\kwd{fileno(}<filehandle>\kwd{)}*}
  904. Returns the file descriptor for a given (open) file.
  905. X
  906. \Xi{\kwd{flock(}<filehandle>\kwd{,}<operation>\kwd{)}}
  907. Calls {\it flock\/}(2) on the file. <operation> adds from 1 (shared), 2
  908. (exclusive), 4 (non-blocking) or 8 (unlock). 
  909. X
  910. X
  911. \Xi{\kwd{getc}[\kwd{(}<filehandle>\kwd{)}*]}
  912. Yields the next character from the file, or |""| on EOF. If
  913. <filehandle> is omitted, reads from |STDIN|. 
  914. X
  915. \Xi{\kwd{ioctl(}<filehandle>\kwd{,}<function>\kwd{,}|\$|<var>\kwd{)}}
  916. performs {\it ioctl}(2) on the file. This function has non-standard
  917. return values. See the manual for details. 
  918. X
  919. \Xi{\kwd{open(}<filehandle>[\kwd{,}<filename>]\kwd{)}}
  920. Opens a file and associates it with <filehandle>. If <filename> is
  921. omitted, the scalar variable of the same name as the <filehandle> must
  922. contain the filename.
  923. X
  924. The following filename conventions apply when opening a file.
  925. X
  926. \begin{enum}{2cm}
  927. \Xi{|"|<file>|"|} open <file> for input. Also |"<|<file>|"|.
  928. X
  929. \Xi{|">|<file>|"|} open <file> for output, creating it if necessary.
  930. X
  931. \Xi{|">>|<file>|"|} open <file> in append mode.
  932. X
  933. \Xi{|"+>|<file>|"|} open <file> with read/write access.
  934. X
  935. \Xi{|"\||<cmd>|"|} opens a pipe to command <cmd>.
  936. X
  937. \Xi{|"|<cmd>|\|"|} opens a pipe from command <cmd>.
  938. \end{enum}
  939. X
  940. <file> may be |&|<filehnd> in which case the new file handle is
  941. connected to the (previously opened) filehandle <filehnd>.
  942. X
  943. \kwd{open} 
  944. returns 1 upon success, \kwd{undef} otherwise, except for pipes. The
  945. parentheses may be omitted, if only a <filehandle> is specified.
  946. X
  947. \Xi{\kwd{pipe(}<readhandle>\kwd{,}<writehandle>\kwd{)}}
  948. Returns a pair of connected pipes.
  949. X
  950. \Xi{\kwd{print}[\kwd{(}[<filehandle>]<list>\dag\kwd{)}*]}
  951. Prints a string or a comma-separated list of strings. If <filehandle>
  952. is omitted, prints by default to standard output (or to the last
  953. selected output channel - see \kwd{select}).  
  954. X
  955. \Xi{\kwd{printf}[\kwd{(}[<filehandle>] <list>\kwd{)}*]}
  956. Equivalent to \kwd{print} <filehandle> \kwd {sprintf(}<list>\kwd{)}.
  957. X
  958. \Xi{\kwd{read(}<filehandle>\kwd{,}|\$|<var>\kwd{,}<length>[\kwd{,}<offset>]\kwd{)}}
  959. Read <length> binary bytes from the file into the variable at
  960. <offset>. Returns number of bytes actually read. 
  961. X
  962. \Xi{\kwd{seek(}<filehandle>\kwd{,}<position>\kwd{,}<whence>\kwd{)}}
  963. Arbitrarily positions the file. Returns 1 upon success, 0 otherwise.
  964. X
  965. \Xi{\kwd{select}[\kwd{(}<filehandle>\kwd{)}]}
  966. Returns the currently selected filehandle. 
  967. Sets the current default filehandle for output operations if
  968. <filehandle> is supplied.
  969. X
  970. \Xi{\kwd{select(}<rbits>\kwd{,}<wbits>\kwd{,}<nbits>\kwd{,}<timeout>\kwd{)}}
  971. Performs a {\it select\/}(2) system call with the same parameters.
  972. X
  973. \Xi{\kwd{sprintf(}<format>\kwd{,}<list>\kwd{)}}
  974. Returns a string formatted by (almost all of) the usual printf
  975. conventions. 
  976. X
  977. \Xi{\kwd{sysread(}<filehandle>\kwd{,}|\$|<var>\kwd{,}<length>[\kwd{,}<offset>]\kwd{)}}
  978. Reads <length> bytes into |$|<var> at <offset>.
  979. X
  980. \Xi{\kwd{syswrite(}<filehandle>\kwd{,}<scalar>\kwd{,}<length>[\kwd{,}<offset>]\kwd{)}}
  981. Writes <length> bytes from <scalar> at <offset>.
  982. X
  983. \Xi{\kwd{tell}[\kwd{(}<filehandle>\kwd{)}]*}
  984. Returns the current file position for the file. If <filehandle> is
  985. omitted, assumes the file last read. 
  986. X
  987. \Xi{\kwd{write}[\kwd{(}<filehandle>\kwd{)}]*}
  988. Writes a formatted record to the specified file, using the format
  989. associated with that file. See ``Formats''. 
  990. X
  991. \end{enum}
  992. X
  993. \makeuppage
  994. X
  995. \section{Search and replace functions}
  996. X
  997. \begin{enum}{1cm}
  998. X
  999. \catcode`\~=\other
  1000. X
  1001. \Xi{[<expr> |=~|] [\kwd{m}]|/|<pattern>|/|[\kwd{g}][\kwd{i}][\kwd{o}]}
  1002. Searches <expr> (default: |$_|) for a pattern. If you prepend an
  1003. \kwd{m} you can use almost any pair of characters as delimiters. If
  1004. used in array context, an array is returned consisting of the
  1005. subexpressions matched by the parentheses in pattern, i.e.
  1006. |($1,$2,$3,...)|.
  1007. \\
  1008. Optional modifiers: \kwd{g} matches as many times as possible; \kwd{i}
  1009. searches in a case-insensitive manner; \kwd{o} interpolates variables
  1010. only once.
  1011. \\
  1012. If <pattern> is empty, the most recent pattern from a
  1013. previous match or replacement is used.
  1014. \\
  1015. With \kwd{g} the match can be used as an iterator in scalar context.
  1016. X
  1017. \Xi{|?|<pattern>|?|}
  1018. This is just like the |/|<pattern>|/| search, except that it matches
  1019. only once between calls to the reset operator. If <pattern> is empty,
  1020. the most recent pattern from a previous match or replacement is used.
  1021. X
  1022. \Xi{[|\$|<var> |=~|] \kwd{s}|/|<pattern>|/|<replacement>|/|[\kwd{g}][\kwd{i}][\kwd{e}][\kwd{o}]}
  1023. Searches a string for a pattern, and if found, replaces that pattern
  1024. with the replacement text and returns the number of substitutions
  1025. made. Otherwise it returns false. 
  1026. \\
  1027. Optional modifiers: \kwd{g} replaces all occurrences of the pattern;
  1028. \kwd{e} interprets the replacement string as an expression; \kwd{i}
  1029. and \kwd{o} as with |/|<pattern>|/| matching. Almost any delimiter may
  1030. replace the slashes; if single quotes are used, no interpretation is
  1031. done on the replacement string.
  1032. \\
  1033. If <pattern> is empty, the most recent pattern from a previous match or replacement is used.
  1034. X
  1035. \Xi{\kwd{study}[\kwd{(}|\$|<var>\dag\kwd{)}*]}
  1036. Study the contents of |$|<var> in anticipation of doing many pattern
  1037. matches on the contents before it is next modified.
  1038. X
  1039. \Xi{[|\$|<var> |=~|] \kwd{tr}|/|<searchlist>|/|<replacementlist>|/|[\kwd{c}][\kwd{d}][\kwd{s}]}
  1040. Translates all occurrences of the characters found in the search list
  1041. with the corresponding character in the replacement list. It returns
  1042. the number of characters replaced. \kwd{y} may be used instead of \kwd{tr}. 
  1043. \\
  1044. Optional modifiers: \kwd{c} complements the <searchlist>; \kwd{d}
  1045. deletes all characters not found in <searchlist>; \kwd{s} squeezes all
  1046. sequences of characters that are translated into the same target
  1047. character into one occurrence of this character.
  1048. X
  1049. \end{enum}
  1050. X
  1051. X
  1052. \section{System interaction} 
  1053. X
  1054. \begin{enum}{1cm}
  1055. X
  1056. \Xi{\kwd{alarm(}<expr>\kwd{)}*}
  1057. Schedules a |SIGALRM| to be delivered after <expr> seconds. 
  1058. X
  1059. \Xi{\kwd{chdir} [\kwd{(}<expr>\kwd{)}*]}
  1060. Changes the working directory, |$ENV{"HOME"}| if <expr> is omitted.
  1061. X
  1062. \Xi{\kwd{chroot(}<filename>\dag\kwd{)}*}
  1063. Changes the root directory for the process and its children.
  1064. X
  1065. \Xi{\kwd{die}[\kwd{(}<list>\kwd{)}*]}
  1066. Prints the value of <list> to |STDERR| and exits with the current
  1067. value of |$!| (errno). If |$!| is 0, exits with the value of |($? >> 8)|.
  1068. If |($? >> 8)| is 0, exits with 255. <list> defaults to
  1069. |"Died."|.
  1070. X
  1071. \Xi{\kwd{exec(}<list>\kwd{)}*}
  1072. Executes the system command in <list>; does not return.
  1073. X
  1074. \Xi{\kwd{exit(}<expr>\kwd{)}*}
  1075. Exits immediately with the value of |EXPR|.
  1076. X
  1077. \Xi{\kwd{fork}}
  1078. Does a {\it fork\/}(2) system call. Returns the child pid to the parent
  1079. process and zero to the child process. 
  1080. X
  1081. \Xi{\kwd{getlogin}}
  1082. Returns the current login name as known by the system.
  1083. X
  1084. \Xi{\kwd{getpgrp}[\kwd{(}<pid>\kwd{)}*]}
  1085. Returns the process group for process <pid> (0, or omitted,  means the
  1086. current process). 
  1087. X
  1088. \Xi{\kwd{getppid}}
  1089. Returns the process id of the parent process.
  1090. X
  1091. \Xi{\kwd{getpriority(}<which>\kwd{,}<who>\kwd{)}}
  1092. Returns the current priority for a process, process group, or user.
  1093. X
  1094. \Xi{\kwd{kill(}<list>\kwd{)}*}
  1095. Sends a signal to a list of processes. The first element of the list
  1096. must be the signal to send (numeric, or its name as a string). 
  1097. X
  1098. \Xi{\kwd{setpgrp(}<pid>\kwd{,}<pgrp>\kwd{)}}
  1099. Sets the process group for the <pid> (0 = current process).
  1100. X
  1101. \Xi{\kwd{setpriority(}<which>\kwd{,}<who>\kwd{,}<prio>\kwd{)}}
  1102. Sets the current priority for a process, process group, or a user.
  1103. X
  1104. \Xi{\kwd{sleep}[\kwd{(}<expr>\kwd{)}*]}
  1105. Causes the script to sleep for <expr> seconds, or forever if no
  1106. <expr>. Returns the number of seconds actually slept. 
  1107. X
  1108. \Xi{\kwd{syscall(}<list>\kwd{)}*}
  1109. Calls the system call specified in the first element of the list,
  1110. passing the rest of the list as arguments to the call. 
  1111. X
  1112. \Xi{\kwd{system(}<list>\kwd{)}*}
  1113. Does exactly the same thing as \kwd{exec }<list> except that a fork is
  1114. done first, and the parent process waits for the child process to complete. 
  1115. X
  1116. \Xi{\kwd{times}}
  1117. Returns a 4-element array (\$user, \$system, \$cuser, \$csystem) giving
  1118. the user and system times, in seconds, for this process and the
  1119. children of this process.  
  1120. X
  1121. \Xi{\kwd{umask}[\kwd{(}<expr>\kwd{)}*]}
  1122. Sets the umask for the process and returns the old one. If <expr> is
  1123. omitted, returns current umask value. 
  1124. X
  1125. \Xi{\kwd{wait}}
  1126. Waits for a child process to terminate and returns the pid of the
  1127. deceased process (-1 if none). The status is returned in |$?|. 
  1128. X
  1129. \Xi{\kwd{waitpid(}<pid>\kwd{,}<flags>\kwd{)}}
  1130. Performs the same function as the corresponding system call.
  1131. X
  1132. \Xi{\kwd{warn(}<list>\kwd{)}*}
  1133. Prints the message on |STDERR| like \kwd{die}, but doesn't exit.
  1134. X
  1135. \end{enum}
  1136. X
  1137. \makeuppage
  1138. X
  1139. \section{Networking} 
  1140. X
  1141. \begin{enum}{1cm}
  1142. X
  1143. \Xi{\kwd{accept(}<newsocket>\kwd{,}<genericsocket>\kwd{)}}
  1144. Accepts a new socket.
  1145. X
  1146. \Xi{\kwd{bind(}<socket>\kwd{,}<name>\kwd{)}}
  1147. Binds the <name> to the <socket>.
  1148. X
  1149. \Xi{\kwd{connect(}<socket>\kwd{,}<name>\kwd{)}}
  1150. Connects the <name> to the <socket>.
  1151. X
  1152. \Xi{\kwd{getpeername(}<socket>\kwd{)}}
  1153. Returns the socket address of the other end of the <socket>.
  1154. X
  1155. \Xi{\kwd{getsockname(}<socket>\kwd{)}}
  1156. Returns the name of the socket.
  1157. X
  1158. \Xi{\kwd{getsockopt(}<socket>\kwd{,}<level>\kwd{,}<optname>\kwd{)}}
  1159. Returns the socket options.
  1160. X
  1161. \Xi{\kwd{listen(}<socket>\kwd{,}<queuesize>\kwd{)}}
  1162. Starts listening on the specified <socket>.
  1163. X
  1164. \Xi{\kwd{recv(}<socket>\kwd{,}<scalar>\kwd{,}<length>\kwd{,}<flags>\kwd{)}}
  1165. Receives a message on <socket>.
  1166. X
  1167. \Xi{\kwd{send(}<socket>\kwd{,}<msg>\kwd{,}<FLAGS[>\kwd{,}<to>]\kwd{)}}
  1168. Sends a message on the <socket>.
  1169. X
  1170. \Xi{\kwd{setsockopt(}<socket>\kwd{,}<level>\kwd{,}<optname>\kwd{,}<optval>\kwd{)}}
  1171. Sets the requested socket option.
  1172. X
  1173. \Xi{\kwd{shutdown(}<socket>\kwd{,}<how>\kwd{)}}
  1174. Shuts down a <socket>.
  1175. X
  1176. \Xi{\kwd{socket(}<socket>\kwd{,}<domain>\kwd{,}<type>\kwd{,}<protocol>\kwd{)}}
  1177. Creates a <socket> in <domain> with <type> and <protocol>.
  1178. X
  1179. \Xi{\kwd{socketpair(}<socket1>\kwd{,}<socket2>\kwd{,}<domain>\kwd{,}<type>\kwd{,}<protocol>\kwd{)}}
  1180. As socket, but creates a pair of bi-directional sockets.
  1181. X
  1182. \end{enum}
  1183. X
  1184. X
  1185. \section{SystemV IPC} 
  1186. X
  1187. The following functions all perform the same action as the
  1188. corresponding system calls.
  1189. X
  1190. \kwd{msgctl(}<id>\kwd{,}<cmd>\kwd{,}<args>\kwd{)} \\
  1191. \kwd{msgget(}<key>\kwd{,}<flags>\kwd{)} \\
  1192. \kwd{msgsnd(}<id>\kwd{,}<msg>\kwd{,}<flags>\kwd{)} \\
  1193. \kwd{msgrcv(}<id>\kwd{,}\$<var>\kwd{,}<size>\kwd{,}<type>\kwd{,}<flags>\kwd{)} \\
  1194. \kwd{semctl(}<id>\kwd{,}<semnum>\kwd{,}<cmd>\kwd{,}<arg>\kwd{)} \\
  1195. \kwd{semget(}<key>\kwd{,}<nsems>\kwd{,}<size>\kwd{,}<flags>\kwd{)} \\
  1196. \kwd{semop(}<key>\kwd{,}...\kwd{)} \\
  1197. \kwd{shmctl(}<id>\kwd{,}<cmd>\kwd{,}<arg>\kwd{)} \\
  1198. \kwd{shmget(}<key>\kwd{,}<size>\kwd{,}<flags>\kwd{)} \\
  1199. \kwd{shmread(}<id>\kwd{,}\$<var>\kwd{,}<pos>\kwd{,}<size>\kwd{)} \\
  1200. \kwd{shmwrite(}<id>\kwd{,}<string>\kwd{,}<pos>\kwd{,}<size>\kwd{)}
  1201. X
  1202. \makeuppage
  1203. X
  1204. \section{Miscellaneous} 
  1205. X
  1206. \begin{enum}{1cm}
  1207. X
  1208. \Xi{\kwd{caller}[\kwd{(}<expr>\kwd{)}]}
  1209. Returns an array (\$package,\$file,\$line,...) for a specific subroutine
  1210. call. ``|caller|'' returns this info for the current subroutine,
  1211. ``|caller(1)|'' for the caller of this subroutine etc..  
  1212. X
  1213. \Xi{\kwd{defined(}<expr>\kwd{)}*}
  1214. Tests whether the lvalue <expr> has a real value.
  1215. X
  1216. \Xi{\kwd{dump} [<label>]}
  1217. Immediate core dump. When reincarnated, starts at <label>.
  1218. X
  1219. \Xi{\kwd{local(}<list>\kwd{)}}
  1220. Creates a scope for the listed variables local to the enclosing block,
  1221. subroutine or eval. 
  1222. X
  1223. \Xi{\kwd{package} <name>}
  1224. Designates the remainder of the current block as a package.
  1225. X
  1226. \Xi{\kwd{require(}\oEXPR\kwd{)}*}
  1227. Includes the specified file from the perl library. Does not include
  1228. more than once, and yields a fatal error if the file does include not OK. 
  1229. X
  1230. \Xi{\kwd{reset} [\kwd{(}<expr>\kwd{)}*]}
  1231. Resets |??| searches so that they work again. <expr> is a list of
  1232. single letters. All variables and arrays beginning with one of those
  1233. letters are reset to their pristine state.  Only affects the current
  1234. package.
  1235. X
  1236. \Xi{\kwd{scalar(}<expr>\kwd{)}}
  1237. Forces evaluation of <expr> in scalar context.
  1238. X
  1239. \Xi{\kwd{sub} <name> \{ <expr> |;| ... \}}
  1240. Designates <name> as a subroutine. Parameters are passed by reference
  1241. as array |@_|. Returns the value of the last expression evaluated. 
  1242. X
  1243. \Xi{\kwd{undef}[\kwd{(}<lvalue>\kwd{)}*]}
  1244. Undefines the <lvalue>. Always returns the undefined value.
  1245. X
  1246. \Xi{\kwd{wantarray}}
  1247. Returns true if the current context expects an array value.
  1248. X
  1249. \end{enum}
  1250. X
  1251. X
  1252. \section{Formats} 
  1253. X
  1254. \kwd{format} [<name>] |=| \\
  1255. <formlist> \\
  1256. |.|
  1257. X
  1258. <formlist> pictures the lines, and contains the arguments which will
  1259. give values to the fields in the lines. Picture fields are:
  1260. X
  1261. |  @<<<...  | left adjusted field, repeat the |<| to denote the desired
  1262. width; \\
  1263. |  @>>>...  | right adjusted field; \\
  1264. |  @|\|\|\||...  | centered field; \\
  1265. |  @#.##... | numeric format with implied decimal point; \\
  1266. |  @*       | a multi-line field.
  1267. X
  1268. Use \^ instead of |@| for multi-line block filling.
  1269. X
  1270. Use |~| at the beginning of a line to suppress unwanted empty lines.
  1271. X
  1272. Use |~~| at the beginning of a line to have this format line repeated
  1273. until all fields are exhausted. 
  1274. X
  1275. Use |$-| to zero to force a page break.
  1276. X
  1277. See also |$|\^, |$~|, |$-| and |$=| in section ``Special Variables''.
  1278. X
  1279. X
  1280. \section{Info from system files} 
  1281. X
  1282. {\large\sl passwd} \\
  1283. Info is (\$name, \$passwd, \$uid, \$gid, \$quota, \$comment, \$gcos, \$dir, \$shell).
  1284. X
  1285. \begin{enum}{6cm}
  1286. X
  1287. \Xi{\kwd{endpwent}}    Ends lookup processing.
  1288. X
  1289. \Xi{\kwd{getpwent}}    Gets next info.
  1290. X
  1291. \Xi{\kwd{getpwnam(}<name>\kwd{)}}    Gets info by name. 
  1292. X
  1293. \Xi{\kwd{getpwuid(}<uid>\kwd{)}}    Gets info by uid.
  1294. X
  1295. \Xi{\kwd{setpwent}}    Resets lookup processing.
  1296. X
  1297. \end{enum}
  1298. X
  1299. {\vskip6pt\large\sl group} \\
  1300. Info is a 4-item array: (\$name, \$passwd, \$gid, \$members).
  1301. X
  1302. \begin{enum}{6cm}
  1303. X
  1304. \Xi{\kwd{endgrent}}    Ends lookup processing.
  1305. X
  1306. \Xi{\kwd{getgrgid(}<gid>\kwd{)}}    Gets info by group id. 
  1307. X
  1308. \Xi{\kwd{getgrnam(}<name>\kwd{)}}    Gets info by name.
  1309. X
  1310. \Xi{\kwd{getgrent}}    Gets next info.
  1311. X
  1312. \Xi{\kwd{setgrent}}    Resets lookup processing.
  1313. X
  1314. \end{enum}
  1315. X
  1316. {\vskip6pt\large\sl hosts} \\
  1317. Info is (\$name, \$aliases, \$addrtype, \$length, @addrs).
  1318. X
  1319. \begin{enum}{6cm}
  1320. X
  1321. \Xi{\kwd{endhostent}}    Ends lookup processing.
  1322. X
  1323. \Xi{\kwd{gethostbyaddr(}<addr>\kwd{,}<addrtype>\kwd{)}}    Gets info by address.
  1324. X
  1325. \Xi{\kwd{gethostbyname(}<name>\kwd{)}}    Gets info by name.
  1326. X
  1327. \Xi{\kwd{gethostent}}    Gets next info.
  1328. X
  1329. \Xi{\kwd{sethostent(}<stayopen>\kwd{)}}    Resets lookup processing.
  1330. X
  1331. \end{enum}
  1332. X
  1333. {\vskip6pt\large\sl networks} \\
  1334. Info is (\$name, \$aliases, \$addrtype, \$net).
  1335. X
  1336. \begin{enum}{6cm}
  1337. X
  1338. \Xi{\kwd{endnetent}}    Ends lookup processing.
  1339. X
  1340. \Xi{\kwd{getnetbyaddr(}<addr>\kwd{,}<type>\kwd{)}}    Gets info by address and type.
  1341. X
  1342. \Xi{\kwd{getnetbyname(}<name>\kwd{)}}    Gets info by name.
  1343. X
  1344. \Xi{\kwd{getnetent}}    Gets next info.
  1345. X
  1346. \Xi{\kwd{setnetent(}<stayopen>\kwd{)}}    Resets lookup processing.
  1347. X
  1348. \end{enum}
  1349. X
  1350. {\vskip6pt\large\sl services} \\
  1351. Info is (\$name, \$aliases, \$port, \$proto).
  1352. X
  1353. \begin{enum}{6cm}
  1354. X
  1355. \Xi{\kwd{endservent}}    Ends lookup processing.
  1356. X
  1357. \Xi{\kwd{getservbyname(}<name>\kwd{, }<proto>\kwd{)}}    Gets info by name. 
  1358. X
  1359. \Xi{\kwd{getservbyport(}<port>\kwd{, }<proto>\kwd{)}}    Gets info by port.
  1360. X
  1361. \Xi{\kwd{getservent}}    Gets next info.
  1362. X
  1363. \Xi{\kwd{setservent(}<stayopen>\kwd{)}}    Resets lookup processing.
  1364. X
  1365. \end{enum}
  1366. X
  1367. {\vskip6pt\large\sl protocols} \\
  1368. X
  1369. Info is (\$name, \$aliases, \$proto).
  1370. X
  1371. \begin{enum}{6cm}
  1372. X
  1373. \Xi{\kwd{endprotoent}}    Ends lookup processing.
  1374. X
  1375. \Xi{\kwd{getprotobyname(}<name>\kwd{)}}    Gets info by name.
  1376. X
  1377. \Xi{\kwd{getprotobynumber(}<number>\kwd{)}}    Gets info by number.
  1378. X
  1379. \Xi{\kwd{getprotoent}}    Gets next info.
  1380. X
  1381. \Xi{\kwd{setprotoent(}<stayopen>\kwd{)}}    Resets lookup processing.
  1382. X
  1383. \end{enum}
  1384. X
  1385. X
  1386. \section{Regular expressions} 
  1387. X
  1388. Each character matches itself, unless it is one of the special
  1389. characters |+?.*()[]{}|\||\|.
  1390. X
  1391. \begin{enum}{1cm}
  1392. X
  1393. \Xj{|.|}
  1394. matches an arbitrary character, but not a newline.
  1395. X
  1396. \Xj{|(|\ldots|)|}
  1397. groups a series of pattern elements to a single element.
  1398. X
  1399. \Xj{|+|}
  1400. matches the preceding pattern element one or more times.
  1401. X
  1402. \Xj{|?|}
  1403. matches zero or one times.
  1404. X
  1405. \Xj{|*|}
  1406. matches zero or more times.
  1407. X
  1408. \Xj{\{<n>|,|<m>\}}
  1409. denotes the minimum <n> and maximum <m> match count. |{|<n>|}| means
  1410. exactly <n> times; |{|<n>|,}| means at least <n> times. 
  1411. X
  1412. \Xj{|\char`\[|\ldots|\char`\]|}
  1413. denotes a class of characters to match. |[|\^\ldots|]| negates the class.
  1414. X
  1415. \Xj{|(|\ldots\|\ldots\|\ldots|)|}
  1416. matches one of the alternatives.
  1417. X
  1418. \end{enum}
  1419. X
  1420. Non-alphanumerics can be escaped from their special meaning using a
  1421. |\|.
  1422. X
  1423. \begin{enum}{1cm}
  1424. X
  1425. \Xj{|\char`\\w|}
  1426. matches alphanumeric, including ``|_|'', |\W| matches non-alphanumeric.
  1427. X
  1428. \Xj{|\char`\\b|}
  1429. matches word boundaries, |\B| matches non-boundaries.
  1430. X
  1431. \Xj{|\char`\\s|}
  1432. matches whitespace, |\S| matches non-whitespace.
  1433. X
  1434. \Xj{|\char`\\d|}
  1435. matches numeric, |\D| matches non-numeric.
  1436. X
  1437. \Xj{|\char`\\n|, |\char`\\r|, |\char`\\f|, |\char`\\t| etc.} 
  1438. have their usual meaning.
  1439. X
  1440. \Xj{|\char`\\w|, |\char`\\s| and |\char`\\d|}
  1441. X may be used within character classes, |\b| denotes backspace in this context.
  1442. X
  1443. \Xj{|\char`\\1|\ldots|\char`\\9|}
  1444. refer to matched sub-expressions, grouped with |()|, inside
  1445. the match. 
  1446. X
  1447. \Xj{|\char`\\10|}
  1448. and up can also be used if the pattern
  1449. matches that many sub-expressions. 
  1450. X
  1451. \end{enum}
  1452. X
  1453. See also |$1|\ldots|$9|, |$+|, |$&|, |$`| and |$'| in section ``Special
  1454. Variables''.
  1455. X
  1456. X
  1457. X
  1458. \section{Special variables} 
  1459. X
  1460. The following variables are global and should be localized in subroutines:
  1461. X
  1462. \begin{enum}{1cm}
  1463. X
  1464. \Xi{|\char`\$\char`\_|}
  1465. The default input and pattern-searching space.
  1466. X
  1467. \Xi{|\char`\$\char`\.|}
  1468. The current input line number of the last filehandle that was read.
  1469. X
  1470. \Xi{|\char`\$\char`\/|}
  1471. The input record separator, newline by default. May be multi-character.
  1472. X
  1473. \Xi{|\char`\$\char`\,|}
  1474. The output field separator for the print operator.
  1475. X
  1476. \Xi{|\char`\$\char`\"|}
  1477. The separator which joins elements of arrays interpolated in strings.
  1478. X
  1479. \Xi{|\char`\$\char`\\|}
  1480. The output record separator for the print operator.
  1481. X
  1482. \Xi{|\char`\$\char`\#|}
  1483. The output format for printed numbers. Initial value is ``|%.20g|''.
  1484. X
  1485. \Xi{|\char`\$\char`\*|}
  1486. Set to 1 to do multiline matching within a string, 0 to assume strings
  1487. contain a single line. Default is 0. 
  1488. X
  1489. \Xi{|\char`\$\char`\?|}
  1490. The status returned by the last |`|<command>|`|, pipe close or
  1491. \kwd{system} operator. 
  1492. X
  1493. \Xi{|\char`\$\char`\]|}
  1494. The perl version string (as displayed with |perl -v|), or version number.
  1495. X
  1496. \Xi{|\char`\$\char`\[|}
  1497. The index of the first element in an array, and of the first character
  1498. in a substring. Default is 0. 
  1499. X
  1500. \Xi{|\char`\$\char`\;|}
  1501. The subscript separator for multi-dimensional array emulation. Default
  1502. is |"\034"|. 
  1503. X
  1504. \Xi{|\char`\$\char`\!|}
  1505. If used in a numeric context, yields the current value of errno. If
  1506. used in a string context, yields the corresponding error string. 
  1507. X
  1508. \Xi{|\char`\$\char`\@|}
  1509. The perl error message from the last eval or \kwd{do} <expr> command.
  1510. X
  1511. \Xi{|\char`\$\char`\:|}
  1512. The set of characters after which a string may be broken to fill
  1513. continuation fields (starting with ``|^|'') in a format. 
  1514. X
  1515. \Xi{|\char`\$\char`\0|}
  1516. The name of the file containing the perl script being executed. May be
  1517. assigned to. 
  1518. X
  1519. \Xi{|\char`\$\char`\$|}
  1520. The process number of the perl running this script. Altered (in the
  1521. child process) by \kwd{fork}. 
  1522. X
  1523. \Xi{|\char`\$\char`\<|}
  1524. The real uid of this process.
  1525. X
  1526. \Xi{|\char`\$\char`\>|}
  1527. The effective uid of this process. 
  1528. X
  1529. \Xi{|\char`\$\char`\(|}
  1530. The real gid of this process.
  1531. X
  1532. \Xi{|\char`\$\char`\)|}
  1533. The effective gid of this process.
  1534. X
  1535. \Xi{|\char`\$\char`\^D|}
  1536. The debug flags as passed to perl using |-D| .
  1537. X
  1538. \Xi{|\char`\$\char`\^F|}
  1539. The highest system file descriptor, ordinarily 2.
  1540. X
  1541. \Xi{|\char`\${\char`\^}I|}
  1542. In-place edit extension as passed to perl using |-i| .
  1543. X
  1544. \Xi{|\char`\$\char`\^P|}
  1545. Internal debugging flag.
  1546. X
  1547. \Xi{|\char`\$\char`\^T|}
  1548. The time (as delivered by \kwd{time}) when the program started. This
  1549. value is used by the file test operators ``|-M|'', ``|-A|'' and
  1550. ``|-C|''.
  1551. X
  1552. \Xi{|\char`\$\char`\^W|}
  1553. The value if the |-w| option as passed to perl.
  1554. X
  1555. \Xi{|\char`\$\char`\^X|}
  1556. The name by which this perl was invoked.
  1557. X
  1558. \end{enum}
  1559. X
  1560. The following variables are context dependent and need not be
  1561. localized:
  1562. X
  1563. \begin{enum}{1cm}
  1564. X
  1565. \Xi{|\char`\$\char`\%|}
  1566. The current page number of the currently selected output channel.
  1567. X
  1568. \Xi{|\char`\$\char`\=|}
  1569. The page length of the current output channel. Default is 60 lines.
  1570. X
  1571. \Xi{|\char`\$\char`\-|}
  1572. The number of lines left on the page.
  1573. X
  1574. \Xi{|\char`\$\char`\~|}
  1575. The name of the current report format.
  1576. X
  1577. \Xi{|\char`\$\char`\^|}
  1578. The name of the current top-of-page format.
  1579. X
  1580. \Xi{|\char`\$\char`\||}
  1581. If set to nonzero, forces a flush after every write or print on the
  1582. currently selected output channel. Default is 0. 
  1583. X
  1584. \Xi{|\char`\$ARGV|}
  1585. The name of the current file when reading from |<>| .
  1586. \end{enum}
  1587. X
  1588. The following variables are always local to the current block:
  1589. X
  1590. \begin{enum}{1cm}
  1591. X
  1592. \Xi{|\char`\$\char`\&|}
  1593. The string matched by the last pattern match.
  1594. X
  1595. \Xi{|\char`\$\char`\`|}
  1596. The string preceding what was matched by the last pattern match.
  1597. X
  1598. \Xi{|\char`\$\char`\'|}
  1599. The string following what was matched by the last pattern match. 
  1600. X
  1601. \Xi{|\char`\$\char`\+|}
  1602. The last bracket matched by the last search pattern.
  1603. X
  1604. \Xi{\$|1|\ldots\$|9|\ldots}
  1605. Contains the subpattern from the corresponding set of parentheses in
  1606. the last pattern matched. |$10|\ldots and up are only available if the
  1607. match contained that many sub-expressions. 
  1608. X
  1609. \end{enum}
  1610. X
  1611. X
  1612. X
  1613. X
  1614. \section{Special arrays} 
  1615. X
  1616. \begin{enum}{1.5cm}
  1617. X
  1618. \Xi{|@ARGV|}
  1619. Contains the command line arguments for the script (not including the command name).
  1620. X
  1621. \Xi{|@INC|}
  1622. Contains the list of places to look for perl scripts to be evaluated
  1623. by the \kwd{do} <filename> and \kwd{require} commands. 
  1624. X
  1625. \Xi{|@\char`\_|}
  1626. Parameter array for subroutines. Also used by \kwd{split} if not in
  1627. array context. 
  1628. X
  1629. \Xi{|\char`\%ENV|}
  1630. Contains the current environment.
  1631. X
  1632. \Xi{|\char`\%INC|}
  1633. List of files that have been \kwd{require}d or \kwd{do}ne.
  1634. X
  1635. \Xi{|\char`\%SIG|}Used to set signal handlers for various signals.
  1636. X
  1637. \end{enum}
  1638. X
  1639. X
  1640. \section{The perl debugger} 
  1641. X
  1642. The perl symbolic debugger is invoked with |perl -d|.
  1643. X
  1644. \begin{enum}{2.5cm}
  1645. X
  1646. \Xi{|h|}
  1647. Prints out a help message.
  1648. X
  1649. \Xi{|T|}
  1650. Stack trace.
  1651. X
  1652. \Xi{|s|}
  1653. Single steps.
  1654. X
  1655. \Xi{|n|}
  1656. Single steps around subroutine call.
  1657. X
  1658. \Xi{|r|}
  1659. Returns from the current subroutine.
  1660. X
  1661. \Xi{|c| [<line>]}
  1662. Continues (until <line>, or another breakpoint or exit).
  1663. X
  1664. \Xi{\fbox{<ret>}}
  1665. Repeats last |s| or |n|.
  1666. X
  1667. \Xi{|l| [<range>]}
  1668. Lists a range of lines. <range> may be a number, start-end,
  1669. start+amount, or a subroutine name. If omitted, lists next window. 
  1670. X
  1671. \Xi{|f| <file>}
  1672. Switches to <file> and start listing it.
  1673. X
  1674. \Xi{|-|}
  1675. Lists previous window.
  1676. X
  1677. \Xi{|w|}
  1678. Lists window around current line.
  1679. X
  1680. \Xi{|l| <sub>}
  1681. Lists the named <sub>routine.
  1682. X
  1683. \Xi{|/|<pattern>|/|}
  1684. Forward search for <pattern>.
  1685. X
  1686. \Xi{|?|<pattern>|?|}
  1687. Backward search for <pattern>.
  1688. X
  1689. \Xi{|L|}
  1690. Lists lines that have breakpoints or actions.
  1691. X
  1692. \Xi{|S|}
  1693. List the names of all subroutines.
  1694. X
  1695. \Xi{|t|}
  1696. Toggles trace mode.
  1697. X
  1698. \Xi{|b| [<line> [<condition>]]}
  1699. Sets breakpoint at <line>, default: current line.
  1700. X
  1701. \Xi{|b| <subname> [<condition>]}
  1702. Sets breakpoint at the subroutine.
  1703. X
  1704. \Xi{|S|}
  1705. Lists names of all subroutines.
  1706. X
  1707. \Xi{|d| [<line>]}
  1708. Deletes breakpoint at the given line.
  1709. X
  1710. \Xi{|D|}
  1711. Deletes all breakpoints.
  1712. X
  1713. \Xi{|a| <line command>}
  1714. Sets an action for line.
  1715. X
  1716. \Xi{|A|}
  1717. Deletes all line actions.
  1718. X
  1719. \Xi{|\char`\<| <command>}
  1720. Sets an action to be executed before every debugger prompt.
  1721. X
  1722. \Xi{|\char`\>| <command>}
  1723. Sets an action to be executed before every |s|, |c| or |n| command.
  1724. X
  1725. \Xi{|V| [<package> [<vars>] ]}
  1726. Lists all variables in a package. Default package is main.
  1727. X
  1728. \Xi{|X| [<vars>]}
  1729. Like |V|, but assumes current package.
  1730. X
  1731. \Xi{|!| [ [-]<number>]}
  1732. Redo a debugging command. Default is previous command.
  1733. X
  1734. \Xi{|H| [-<number>]}
  1735. Displays the last -<number> commands of more than one letter.
  1736. X
  1737. \Xi{|q|}
  1738. Quits. You may also use your \fbox{<eof>} character.
  1739. X
  1740. \Xi{<command>}
  1741. Executes <command> as a perl statement.
  1742. X
  1743. \Xi{|p| \oEXPR}
  1744. Prints <expr>.
  1745. X
  1746. \Xi{|=|< >[<alias value>]}
  1747. Sets alias, or lists current aliases.
  1748. X
  1749. \end{enum}
  1750. X
  1751. X
  1752. \newpage
  1753. \unnumbered{Notes}
  1754. \vfill
  1755. \makebox[\textwidth]{Perl Reference Guide Revision \refrev \hfill
  1756. \copyright 1989,1992 Johan Vromans}
  1757. X
  1758. X
  1759. \end{document}
  1760. SHAR_EOF
  1761. chmod 0644 refbase.tex ||
  1762. echo 'restore of refbase.tex failed'
  1763. Wc_c="`wc -c < 'refbase.tex'`"
  1764. test 47244 -eq "$Wc_c" ||
  1765.     echo 'refbase.tex: original size 47244, current size' "$Wc_c"
  1766. rm -f _shar_wnt_.tmp
  1767. fi
  1768. rm -f _shar_seq_.tmp
  1769. echo You have unpacked the last part
  1770. exit 0
  1771. exit 0 # Just in case...
  1772.