home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1455 < prev    next >
Encoding:
Internet Message Format  |  1990-12-28  |  24.4 KB

  1. From: jv@mh.nl (Johan Vromans)
  2. Newsgroups: comp.lang.perl,alt.sources
  3. Subject: TeX version of the Perl Reference Guide - part 1 of 2
  4. Message-ID: <JV.90Jun13103754@squirrel.mh.nl>
  5. Date: 13 Jun 90 16:37:54 GMT
  6. X-Checksum-Snefru: 9884ed9e ac92ddd9 df9a63ad 87bbe6c6
  7.  
  8. This is a TeX version of the information on the Perl Reference Guide,
  9. based on guide version 3.0.18.2. It will create a printable copy of
  10. the information on the Guide, but not its fancy formatting.
  11.  
  12. NOTE:    This TeX document has been created by Raymond Chen
  13.     <raymond@math.berkeley.edu>. You should contact him for details
  14.     and remarks. I'm only passing it through.
  15.  
  16. Submitted-by: Raymond Chen <raymond@math.berkeley.edu>
  17. Archive-name: perlref.tex/part01
  18.  
  19. ---- Cut Here and unpack ----
  20. #!/bin/sh
  21. # This is perlref.tex, a shell archive (shar 3.24)
  22. # made 06/13/1990 08:34 UTC by jv@squirrel
  23. # Source directory /u/jv/perlref/TeX
  24. #
  25. # existing files WILL be overwritten
  26. #
  27. # This is part 1 of a multipart archive                                    
  28. # do not concatenate these parts, unpack them in order with /bin/sh        
  29. #
  30. # This shar contains:
  31. # length  mode       name
  32. # ------ ---------- ------------------------------------------
  33. #  37522 -rw-r--r-- perlref.tex
  34. #
  35. if touch 2>&1 | fgrep '[-amc]' > /dev/null
  36.  then TOUCH=touch
  37.  else TOUCH=true
  38. fi
  39. if test -r shar3_seq_.tmp; then
  40.     echo "Must unpack archives in sequence!"
  41.     next=`cat shar3_seq_.tmp`; echo "Please unpack part $next next"
  42.     exit 1
  43. fi
  44. # ============= perlref.tex ==============
  45. echo "x - extracting perlref.tex (Text)"
  46. sed 's/^X//' << 'SHAR_EOF' > perlref.tex &&
  47. X% Perl Reference Guide (for perl version 3.0)
  48. X%
  49. X% Perl designed and created by Larry Wall <lwall@jpl-devvax.jpl.nasa.gov>
  50. X% Reference guide designed and created by Johan Vromans <jv@mh.nl>
  51. X% TeX version by Raymond Chen <raymond@math.berkeley.edu>
  52. X%
  53. X% Copyright 1989, 1990 Johan Vromans
  54. X% TeX version Copyright 1990 Raymond Chen
  55. X%
  56. X% Rev. 3.0.18.1  Use and reproduction of this information is unlimited.
  57. X%
  58. X% Changes to Johan's wording are marked by %%rjc%%
  59. X%
  60. X%%%%%%%%%% This file uses one nonstandard font for the title page.
  61. X% If you don't have it, then change the following \iffalse to \iftrue.
  62. X\iffalse
  63. X    \let\twelvebf=\bf
  64. X\else
  65. X    \font\twelvebf=cmbx12
  66. X\fi
  67. X%%%%%%%%%% You may steal the following magic macros.
  68. X%
  69. X% Magic:
  70. X%
  71. X% |stuff| puts the stuff in \tt.
  72. X% <stuff> puts the stuff in \it.
  73. X
  74. X%% verbatim macros
  75. X\chardef\other=12
  76. X\def\ttverbatim{\begingroup \catcode`\\=\other \catcode`\{=\other
  77. X\catcode`\}=\other \catcode`\$=\other \catcode`\&=\other
  78. X\catcode`\#=\other \catcode`\%=\other \catcode`\~=\other
  79. X\catcode`\_=\other \catcode`\^=\other \catcode`\<=\other
  80. X\obeyspaces \obeylines \tt}
  81. X
  82. X{\catcode`\|=\active
  83. X\obeylines \gdef|{\leavevmode%
  84. X   \ttverbatim \spaceskip.5em plus.25em minus.15em%
  85. X   \let^^M=\  \let|=\endgroup \escapechar`\|}}
  86. X
  87. X\catcode`\|=\active
  88. X\def\|{\leavevmode\hbox{\tt\char`\|}}
  89. X
  90. X\catcode`\<=\active
  91. X\def<{\leavevmode\italicizerest}
  92. X\def\italicizerest#1>{{\it#1\/}}
  93. X
  94. X\def\cstok#1{\leavevmode\thinspace\hbox{\vrule\vtop{\vbox{\hrule\kern1pt%
  95. X  \hbox{\vphantom{\tt/}\thinspace{\tt#1}\thinspace}}%
  96. X  \kern1pt\hrule}\vrule}\thinspace}
  97. X
  98. X\catcode`\&=\active
  99. X\let&=\undefined
  100. X
  101. X\def\*{$^\dagger$}
  102. X
  103. X\newdimen\tablewidth
  104. X\def\table{\everypar={\nextitem}\parindent=0pt\tablewidth}
  105. X\def\endtable{\everypar={}\par}
  106. X
  107. X\def\outtext{\everypar={\hangindent=3pc\relax}\parindent0pt\relax}
  108. X\def\text{\everypar={}\parindent0pt\relax}
  109. X
  110. X\def\nextitem{\bgroup\let\par\means\obeylines\global\setbox0=\hbox\bgroup}
  111. X\def\means{\enskip\egroup\egroup
  112. X    \ifdim\wd0>\tablewidth
  113. X       \hangindent\tablewidth
  114. X       \box0\hfill\break
  115. X       \hskip\tablewidth
  116. X    \else\hangindent\tablewidth
  117. X          \hbox to\tablewidth{\box0\hss}%
  118. X    \fi\ignorespaces}
  119. X
  120. X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  121. X
  122. X\centerline{\twelvebf Perl Reference Guide}
  123. X\centerline{\bf for perl version 3.0}
  124. X\medskip
  125. X\hbox to \hsize{\hss
  126. X      Perl program designed and
  127. X      created by Larry Wall |<lwall@jpl-devvax.jpl.nasa.gov>|\hss}
  128. X\hbox to \hsize{\hss
  129. X      Reference guide designed and created by Johan Vromans |<jv@mh.nl>|\hss}
  130. X\hbox to \hsize{\hss
  131. X      \TeX\ version by Raymond Chen |<raymond@math.berkeley.edu>|\hss}
  132. X\medskip
  133. X\centerline{Copyright \copyright 1989, 1990 Johan Vromans}
  134. X\centerline{\TeX\ version Copyright 1990 Raymond Chen}
  135. X\centerline{Rev. 3.0.18.1}
  136. X\centerline{Use and reproduction of this information is unlimited.}
  137. X\bigskip
  138. X
  139. X\centerline{\bf Contents}
  140. X\bigskip
  141. X\line{\hss\catcode`\?=\active \let?=\space
  142. X\def\<#1. #2.{\hbox{#1\quad#2}}
  143. X\vbox{
  144. X\<?1. Command line options.
  145. X\<?2. Literals.
  146. X\<?3. Variables.
  147. X\<?4. Statements.
  148. X\<?5. Flow control.
  149. X\<?6. Operators.
  150. X\<?7. File test operators.
  151. X\<?8. Arithmetic functions.
  152. X\<?9. Conversion functions.
  153. X\<10. Structure conversion.
  154. X\<11. String functions.
  155. X\<12. Array and list functions.
  156. X}\qquad\vbox{
  157. X\<13. File operations.
  158. X\<14. Directory reading routines.
  159. X\<15. Input/Output.
  160. X\<16. Search and replace functions.
  161. X\<17. System interaction.
  162. X\<18. Networking.
  163. X\<19. Miscellaneous.
  164. X\<20. Info from system files.
  165. X\<21. Regular expressions.
  166. X\<22. Formats.
  167. X\<23. Special variables.
  168. X\<24. Special arrays.
  169. X}\hss}
  170. X
  171. X\beginsection 1. Command line options
  172. X
  173. X\table1.2in
  174. X
  175. X|-a|
  176. Xturns on autosplit mode when used with |-n| or |-p|.  Splits to |@F|.
  177. X
  178. X|-d|
  179. Xruns the script under the debugger. Use ``|-de 0|'' to start the
  180. Xdebugger without a script.
  181. X
  182. X|-D|<number>
  183. Xsets debugging flags.
  184. X
  185. X|-e| <commandline>
  186. X    may be used to enter one line of script. Multiple
  187. X    |-e| commands may be given to build up a multi-line script.
  188. X
  189. X|-i|<extension>
  190. X        specifies that files processed by
  191. X        the |<>| construct are to be edited in-place.
  192. X
  193. X|-I|<directory>
  194. X        with |-P|:  tells the C preprocessor where to look
  195. X        for include files.
  196. X
  197. X|-n|
  198. Xassumes an input loop around your script. Lines are not printed.
  199. X
  200. X|-p|
  201. Xassumes an input loop around your script. Lines are printed.
  202. X
  203. X|-P|
  204. Xruns the C preprocessor on the script before compilation by perl.
  205. X
  206. X|-s|
  207. X    interprets ``|-xxx|'' on the command line as switches and sets the
  208. X    corresponding variables |$xxx| in the script.
  209. X
  210. X|-S|
  211. Xuses the |PATH| environment variable to search for the script.
  212. X
  213. X|-u|
  214. Xdumps core after compiling the script.
  215. X
  216. X|-U|
  217. Xallows perl to do unsafe operations.
  218. X
  219. X|-v|
  220. Xprints the version and patchlevel of your perl executable.
  221. X
  222. X|-w|
  223. X     prints warnings about possible spelling errors and other error-prone
  224. X     constructs in the script.
  225. X\endtable
  226. X
  227. X\beginsection 2. Literals
  228. X
  229. X\outtext
  230. X
  231. XNumeric: |123|,  |123.4|,  |5E-10|,  |0xff| (hex),  |0377| (octal).
  232. X
  233. XString: |"abc"|,  |'abc'|.
  234. X   Variables are interpolated when |"|\dots|"| are used. \hfil\break
  235. X   |q/|\dots|/|
  236. X   can be used instead of |'|\dots|'|, |qq/|\dots|/| instead of |"|\dots|"|,
  237. X   (any delimiter instead of |/|\dots|/|).
  238. X
  239. XArray: |(1,2,3)|. |()| is empty array.
  240. X    Also: |($a,$b,@rest) = (1,2,|\dots|);|
  241. X    Enums are fine: |(1..4)| is |(1,2,3,4)|. Likewise |('abc'..'ade')|.
  242. X
  243. XFilehandles:
  244. X|<STDIN>|, |<STDOUT>|, |<STDERR>|, |<handle>|, |<$var>|.
  245. X|<>| is the input stream formed by the files specified in |@ARGV|,
  246. Xor |STDIN| if no arguments are supplied.
  247. X
  248. XGlobs:
  249. X|<pattern>| evaluates to all filenames according to the pattern.
  250. XUse |<${var}>| to glob from a variable.
  251. X
  252. XCommands:
  253. X|`command`| evaluates to the output of the command.
  254. X
  255. XHere-Is: |<<identifier| |#| the identifier must follow |<<| immediately
  256. X                            \hfill\break
  257. X{\it input text}            \hfill\break
  258. X|identifier|
  259. X
  260. X\beginsection 3. Variables
  261. X
  262. X\table 1.2in
  263. X
  264. X|$var|
  265. X          a simple scalar variable
  266. X
  267. X|$var[28]|
  268. X          29th element of array |@var| (the |[]| are part of it)
  269. X
  270. X|$var{'Feb'}|
  271. X          one value from associative array |%var|
  272. X
  273. X|$#var|
  274. X          last index of array |@var|
  275. X
  276. X|@var|
  277. X          the entire array
  278. X
  279. X|@var[3,4,5]|
  280. X          a slice of the array |@var|
  281. X
  282. X|@var{'a','b'}|
  283. X          a slice of |%var|; same as |($var{'a'},$var{'b'})|
  284. X
  285. X|%var|
  286. X          the entire associative array
  287. X
  288. X|$var{'a',1,|\dots|}|
  289. X          emulates a multi-dimensional array
  290. X
  291. X|('a',1,|\dots|)[4]|
  292. X          subscripts an array literal
  293. X
  294. X|*name|
  295. X          refers to all objects represented by name.      \hfil\break
  296. X          ``|*name1 = *name2|'' makes |name1| identical to |name2|.
  297. X\endtable
  298. X
  299. X\beginsection 4. Statements
  300. X
  301. X\text
  302. X
  303. XEvery statement is an expression, optionally followed by a modifier, and
  304. Xterminated by a semi-colon.
  305. X
  306. XExecution of expressions can depend on other expressions using one of
  307. Xthe modifiers ``if'', ``unless'', ``while'' or ``until'', e.g.:
  308. X$$\vbox{
  309. X\hbox{<EXPR1> if <EXPR2>;}
  310. X\hbox{<EXPR1> until <EXPR2>;}}$$
  311. X
  312. XAlso, by using one of the logical operators ``\|\|'', ``|&&|''
  313. Xor ``|?:|'', e.g.:
  314. X$$\vbox{
  315. X\hbox{<EXPR1> \|\| <EXPR2>;}
  316. X\hbox{<EXPR1> ? <EXPR2> : <EXPR3>;}}$$
  317. X
  318. XStatements can be combined to form a <BLOCK> when enclosed in |{}|.
  319. X
  320. XCompound statements may be used to control flow (|[]| denote optional
  321. Xparts, \* means: defaults to |$_| if omitted):
  322. X$$\vbox{
  323. X\hbox{if (<EXPR>) <BLOCK> [ [ elsif (<EXPR>) <BLOCK> \dots\ ] else <BLOCK> ]}
  324. X\hbox{unless (<EXPR>) <BLOCK> [ else <BLOCK> ]}
  325. X\hbox{[<LABEL>:] while (<EXPR>) <BLOCK> [ continue <BLOCK> ]}
  326. X\hbox{[<LABEL>:] until (<EXPR>) <BLOCK> [ continue <BLOCK> ]}
  327. X\hbox{[<LABEL>:] for (<EXPR>; <EXPR>; <EXPR>) <BLOCK>}
  328. X\hbox{[<LABEL>:] foreach <VAR>\*\ (<ARRAY>) <BLOCK>}
  329. X\hbox{[<LABEL>:] <BLOCK> [ continue <BLOCK> ]}}$$
  330. X
  331. XSpecial forms are:
  332. X$$\vbox{
  333. X\hbox{do <BLOCK> while <EXPR>;}
  334. X\hbox{do <BLOCK> until <EXPR>;}}$$
  335. Xwhich are guaranteed to perform <BLOCK> once before testing <EXPR>.
  336. X
  337. X\beginsection 5. Flow control
  338. X
  339. X\table 1in
  340. X
  341. Xdo <BLOCK>
  342. XReturns the value of the last command in the sequence of
  343. Xcommands indicated by <BLOCK>.
  344. X
  345. Xdo <SUBROUTINE> (<LIST>)
  346. XExecutes a <SUBROUTINE> declared by a |sub| declaration, and
  347. Xreturns the value of the last expression evaluated in
  348. X<SUBROUTINE>. Also: |&|<SUBROUTINE>.
  349. X
  350. Xdo <EXPR>
  351. XUses the value of <EXPR> as a filename and executes the contents of
  352. Xthe file as a perl script. Errors are returned in |$@|.
  353. X
  354. Xgoto <LABEL>
  355. XContinue execution at the specified label.
  356. X
  357. Xlast [<LABEL>]
  358. XImmediately exits the loop in question. Skips continue block.
  359. X
  360. Xnext [<LABEL>]
  361. XStarts the next iteration of the loop.
  362. X
  363. Xredo [<LABEL>]
  364. XRestarts the loop block without evaluating the conditional again.
  365. X
  366. Xreturn <EXPR>
  367. XReturns from a subroutine with the value specified.
  368. X\endtable
  369. X
  370. X\beginsection 6. Operators
  371. X
  372. X\table 1in
  373. X
  374. X|+|  |-|  |*|  |/|
  375. XAddition, subtraction, multiplication, division.
  376. X
  377. X|%|
  378. XModulo division.
  379. X
  380. X\|    |&|   |^|
  381. XBitwise or, bitwise and, bitwise exclusive or.
  382. X
  383. X|>>|  |<<|
  384. XBitwise shift right, bitwise shift left.
  385. X
  386. X|**|
  387. XExponentiation.
  388. X
  389. X|.|
  390. XConcatenation of two strings.
  391. X
  392. X|x|
  393. XReturns a string consisting of the left operand repeated the
  394. Xnumber of times specified by the right operand.
  395. X
  396. X\medskip\noindent
  397. XAll of the above operators also have an assignment operator, e.g. ``|.=|''.
  398. X\medskip
  399. X
  400. X|++| |--|
  401. XAuto-increment (magical on strings), auto-decrement.
  402. X
  403. X|?:|
  404. XAlternation (if-then-else) operator.
  405. X
  406. X\|\| |&&|
  407. XLogical or, logical and.
  408. X
  409. X|==| |!=|
  410. XNumeric equality, inequality.
  411. X
  412. X|eq| |ne|
  413. XString equality, inequality.
  414. X
  415. X|<| |>|
  416. XNumeric less than, greater than.
  417. X
  418. X|lt| |gt|
  419. XString less than, greater than.
  420. X
  421. X|<=| |>=|
  422. XNumeric less (greater) than or equal to.
  423. X
  424. X|le| |ge|
  425. XString less (greater) than or equal.
  426. X
  427. X|=~| |!~|
  428. XSearch pattern, substitution, or translation (negated).
  429. X
  430. X|..|
  431. XEnumeration, also input line range operator.
  432. X
  433. X|,|
  434. XComma operator.
  435. X\endtable
  436. X
  437. X\beginsection 7. File test operators
  438. X
  439. X\text
  440. X
  441. X%%rjc%% Changed "This unary operator" to "These unary operators"
  442. X%%rjc%%  and concomitant grammar changes
  443. X
  444. XThese unary operators take one argument, either a filename or a
  445. Xfilehandle, and test the associated file to see if something is true about
  446. Xit. If the argument is omitted, tests |$_|
  447. X(except for |-t|, which tests |STDIN|).
  448. XIf the special argument |_| (underscore) is passed, uses the info of the
  449. Xpreceding test.
  450. X\medskip
  451. X
  452. X\table 1in
  453. X
  454. X|-r|/|-w|/|-x|/|-o|
  455. XFile is readable/writable/executable/owned by effective uid.
  456. X
  457. X|-R|/|-W|/|-X|/|-O|
  458. XFile is readable/writable/executable/owned by real uid.
  459. X
  460. X|-e|/|-z|/|-s|
  461. XFile exists / has zero/non-zero size.
  462. X
  463. X|-f|/|-d|
  464. XFile is a plain file, a directory.
  465. X
  466. X|-l|/|-S|/|-p|
  467. XFile is a symbolic link, a socket,  a named pipe (FIFO).
  468. X
  469. X|-b|/|-c|
  470. XFile is a block/character special file.
  471. X
  472. X|-u|/|-g|/|-k|
  473. XFile has setuid/setgid/sticky bit set.
  474. X
  475. X|-t|
  476. XTests if filehandle (STDIN by default) is opened to a tty.
  477. X
  478. X|-T|/|-B|
  479. XFile is a text/non-text (binary) file.  Both |-T| and |-B| return
  480. X<TRUE> on a null file, or a file at EOF when testing a
  481. Xfilehandle.
  482. X
  483. X\text
  484. X\medskip
  485. XAn |*| after the parameter list indicates that this function may be used
  486. Xeither as a function or as a unary operator, without the parentheses.
  487. XThe symbol \*\ after a parameter indicates that this parameter will default
  488. Xto |$_| if omitted.
  489. X
  490. X\beginsection 8. Arithmetic functions
  491. X
  492. X\table1.2in
  493. X
  494. Xatan2($X$,$Y$)
  495. XReturns the arctangent of $X/Y$ in the range $-\pi$ to $\pi$.
  496. X
  497. Xcos(<EXPR>\*)*
  498. XReturns the cosine of <EXPR> (expressed in radians).
  499. X
  500. Xexp(<EXPR>\*)*
  501. XReturns e to the power of <EXPR>.
  502. X
  503. Xint(<EXPR>\*)*
  504. XReturns the integer portion of <EXPR>.
  505. X
  506. Xlog(<EXPR>\*)*
  507. XReturns natural logarithm (base $e$) of <EXPR>.
  508. X
  509. Xrand [(<EXPR>)*]
  510. XReturns a random fractional number between 0 and the value of
  511. X<EXPR>. If <EXPR> is omitted, returns a value between 0 and 1.
  512. X
  513. Xsin(<EXPR>\*)*
  514. XReturns the sine of <EXPR> (expressed in radians).
  515. X
  516. Xsqrt(<EXPR>\*)*
  517. XReturn the square root of <EXPR>.
  518. X
  519. Xsrand[(<EXPR>)*]
  520. XSets the random number seed for the rand operator.
  521. X
  522. Xtime
  523. XReturns the number of seconds since January 1, 1970. Suitable for
  524. Xfeeding to gmtime(\dots) and localtime(\dots).
  525. X\endtable
  526. X
  527. X\beginsection 9. Conversion functions
  528. X
  529. X\table 1.2in
  530. X
  531. Xgmtime(<EXPR>)*
  532. XConverts a time as returned by the time function to a 9-element
  533. Xarray |($sec, $min, $hour, $mday, $mon, $year, $wday, $yday,
  534. X$isdst)| with the time analyzed for the Greenwich timezone. |$mon|
  535. Xhas the range $0\ldots11$ and |$wday| has the range $0\ldots6$.
  536. X
  537. X%%rjc%% \* added
  538. Xhex(<EXPR>\*)*
  539. XReturns the decimal value of <EXPR> interpreted as an hex string.
  540. X
  541. Xlocaltime(<EXPR>)*
  542. XConverts a time as returned by the time function to a 9-element
  543. Xarray with the time analyzed for the local timezone.
  544. X
  545. X%%rjc%% \* added
  546. Xoct(<EXPR>\*)*
  547. XReturns the decimal value of <EXPR> interpreted as an octal string.
  548. XIf <EXPR> starts off with 0x, interprets it as a hex string instead.
  549. X
  550. Xord(<EXPR>\*)*
  551. XReturns the ascii value of the first character of <EXPR>.
  552. X
  553. Xvec(<EXPR>,<OFFSET>,<BITS>)
  554. XTreats <EXPR> as a string of unsigned ints, and yields the bit at
  555. X<OFFSET>. <BITS> must be between 1 and 32. May be used as an
  556. Xlvalue.
  557. X\endtable
  558. X
  559. X\text
  560. X\medskip
  561. XA <LIST> is a (possibly parenthesised) list of expressions, variables or
  562. X<LIST>s. In all circumstances, an array variable or an array slice may be
  563. Xused instead of a <LIST>.
  564. X
  565. X\beginsection 10. Structure conversion
  566. X
  567. X\table 1.2in
  568. X
  569. Xpack(<TEMPLATE>,<LIST>)
  570. XPacks the values into a binary structure using <TEMPLATE>.
  571. X
  572. Xunpack(<TEMPLATE>,<EXPR>)
  573. XUnpacks the structure <EXPR> into an array, using <TEMPLATE>.
  574. X\endtable
  575. X
  576. X\text
  577. X\medskip
  578. X<TEMPLATE> is a sequence of characters as follows:
  579. X
  580. X\table .4in
  581. X|a|/|A|
  582. X         Ascii string, null/space padded
  583. X
  584. X|c|/|C|
  585. X         Native/unsigned char value
  586. X
  587. X|s|/|S|
  588. X         Signed/unsigned short value
  589. X
  590. X|i|/|I|
  591. X         Signed/unsigned integer value
  592. X
  593. X|l|/|L|
  594. X         Signed/unsigned long value
  595. X
  596. X|n|/|N|
  597. X         Short/long in network byte order
  598. X
  599. X|p|
  600. X         Pointer to a string
  601. X
  602. X|x|
  603. X         Null byte
  604. X\endtable
  605. X\text
  606. X\medskip
  607. XEach character may be followed by a decimal number which will be used
  608. Xas a repeat count. Spaces may be included in the template for readability
  609. Xpurposes.
  610. X
  611. X\beginsection 11. String functions
  612. X
  613. X\table 1.2in
  614. X
  615. Xchop(<LIST>\*)
  616. XChops off the last character on all elements of the list; returns the
  617. Xlast chopped character. The parentheses may be omitted if <LIST> is
  618. Xa single variable.
  619. X
  620. Xcrypt(<PLAINTEXT>,<SALT>)
  621. XEncrypts a string.
  622. X
  623. X%%rjc%%\* added
  624. Xeval(<EXPR>\*)*
  625. X<EXPR> is parsed and executed as if it were a little perl program.
  626. XThe value returned is the value of the last expression evaluated. If
  627. Xthere is a syntax error or runtime error, an undefined string is
  628. Xreturned by eval, and |$@| is set to the error message.
  629. X
  630. Xindex(<STR>,<SUBSTR>)
  631. XReturns the position of <SUBSTR> in <STR>. If the substring is not
  632. Xfound, returns |$[|${}-1$.
  633. X
  634. X%%rjc%% \* added
  635. Xlength(<EXPR>\*)*
  636. XReturns the length in characters of the value of <EXPR>.
  637. X
  638. Xrindex(<STR>,<SUBSTR>)
  639. XReturns the position of the last occurrence of <SUBSTR> in <STR>.
  640. X
  641. Xsubstr(<EXPR>,<OFFSET>,<LEN>)
  642. XExtracts a substring out of <EXPR> and returns it. If <OFFSET> is
  643. Xnegative, counts from the end of the string. May be used as an
  644. Xlvalue.
  645. X\endtable
  646. X
  647. X\beginsection 12. Array and list functions
  648. X
  649. X\table 1.2in
  650. X
  651. Xdelete |$|<ARRAY>$\{$<KEY>$\}$
  652. XDeletes the specified value from the specified associative array.
  653. XReturns the deleted value.
  654. X
  655. Xeach(|%|<ARRAY>)*
  656. XReturns a 2-element array consisting of the key and value for the
  657. Xnext value of an associative array. Entries are returned in an
  658. Xapparently random order. When the array is entirely read, a null
  659. Xarray is returned. The next call to each(\dots) after that will start
  660. Xiterating again.
  661. X
  662. Xgrep(<EXPR>,<LIST>)
  663. XEvaluates <EXPR> for each element of the <LIST>, locally setting |$_| to
  664. Xrefer to the element. Modifying |$_| will modify the corresponding
  665. Xelement from <LIST>. Returns array of elements from <LIST> for
  666. Xwhich <EXPR> returned true.
  667. X
  668. Xjoin(<EXPR>,<LIST>)
  669. XJoins the separate strings of <LIST> into a single string with fields
  670. Xseparated by the value of <EXPR>, and returns the string.
  671. X
  672. Xkeys(|%|<ARRAY>)*
  673. XReturns a normal array consisting of all the keys of the named
  674. Xassociative array.
  675. X
  676. Xpop(|@|<ARRAY>)*
  677. XPops and returns the last value of the array, shortens the array by 1.
  678. X
  679. Xpush(|@|<ARRAY>,<LIST>)
  680. XPushes the values of <LIST> onto the end of <ARRAY>. The length of
  681. X<ARRAY> increases by the length of <LIST>.
  682. X
  683. Xreverse(<LIST>)*
  684. XReturns the <LIST> in reverse order.
  685. X
  686. Xshift[(|@|<ARRAY>)*]
  687. XShifts the first value of the array off and returns it, shortening the
  688. Xarray by 1 and moving everything down. If |@|<ARRAY> is omitted,
  689. Xshifts |@ARGV| in main and |@_| in subroutines.
  690. X
  691. Xsort([<SUBROUTINE>] <LIST>)*
  692. XSorts the <LIST> and returns the sorted array value. If
  693. X<SUBROUTINE> is specified, gives the name of a subroutine that
  694. Xreturns less than zero, zero, or greater than zero, depending on how
  695. Xthe elements of the array, available to the routine as |$a| and |$b|, are
  696. Xto be ordered.
  697. X
  698. Xsplice(|@|<ARRAY>,<OFFSET>[,<LENGTH>[,<LIST>]])
  699. XRemoves the elements of |@|<ARRAY> designated by <OFFSET> and
  700. X<LENGTH>, and replaces them with <LIST> (if specified).
  701. XReturns the elements removed.
  702. X
  703. Xsplit[(/<PATTERN>/[,<EXPR>\*[,<LIMIT>]])]
  704. XSplits a string into an array of strings, and returns it. If <LIMIT> is
  705. Xspecified, splits in no more than that many fields. If <PATTERN> is
  706. Xalso omitted, splits on whitespace (\hbox{|/[ \t\n]+/|}). If not in array
  707. Xcontext: returns number of fields and splits to |@_|.
  708. X
  709. Xunshift(|@|<ARRAY>,<LIST>)
  710. XPrepends list to the front of the array, and returns the number of
  711. Xelements in the new array.
  712. X
  713. Xvalues(|%|<ARRAY>)*
  714. XReturns a normal array consisting of all the values of the named
  715. Xassociative array.
  716. X\endtable
  717. X
  718. X\beginsection 13. File operations
  719. X
  720. X\text
  721. X
  722. XFunctions operating on a list of files return the number of files
  723. Xsuccessfully operated upon.
  724. X\medskip
  725. X
  726. X\table 1.2in
  727. X
  728. Xchmod(<LIST>)*
  729. XChanges the permissions of a list of files. The first element of the
  730. Xlist must be the numerical mode.
  731. X
  732. Xchown(<LIST>)*
  733. XChanges the owner and group of a list of files. The first two
  734. Xelements of the list must be the numerical uid and gid.
  735. X
  736. Xlink(<OLDFILE>,<NEWFILE>)
  737. XCreates a new filename linked to the old filename.
  738. X
  739. Xlstat(<FILE>)
  740. XLike stat, but does not traverse a final symbolic link.
  741. X
  742. Xmkdir(<DIR>,<MODE>)
  743. XCreates a directory with given permissions. Sets |$!| on failure.
  744. X
  745. Xselect(<RBITS>,<WBITS>,<NBITS>,<TIMEOUT>)
  746. XPerforms a select(2) system call with the same parameters.
  747. X
  748. Xreadlink(<EXPR>\*)*
  749. XReturns the value of a symbolic link.
  750. X
  751. Xrename(<OLDNAME>,<NEWNAME>)
  752. XChanges the name of a file.
  753. X
  754. Xrmdir(<FILENAME>\*)*
  755. XDeletes the directory if it is empty. Sets |$!| on failure.
  756. X
  757. Xstat(<FILE>)
  758. XReturns a 13-element array |($dev, $ino, $mode, $nlink, $uid, $gid,
  759. X$rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks)|. <FILE> can
  760. Xbe a filehandle, an expression evaluating to a filename, or |_| to refer
  761. Xto the last file test operation. The parentheses may be omitted if
  762. X<FILE> is a filehandle, a variable, or |_|.
  763. X
  764. Xsymlink(<OLDFILE>,<NEWFILE>)
  765. XCreates a new filename symbolically linked to the old filename.
  766. X
  767. Xunlink(<LIST>)*
  768. XDeletes a list of files.
  769. X
  770. Xutime(<LIST>)*
  771. XChanges the access and modification times on each file of a list of
  772. Xfiles. The first two elements of the list must be the numerical
  773. Xaccess and modification times.
  774. X\endtable
  775. X
  776. X\beginsection 14. Directory reading routines
  777. X
  778. X\table1.2in
  779. X
  780. Xclosedir(<DIRHANDLE>)*
  781. XCloses a directory opened by opendir.
  782. X
  783. Xopendir(<DIRHANDLE>,<DIRNAME>)
  784. XOpens a directory on the handle specified.
  785. X
  786. Xreaddir(<DIRHANDLE>)*
  787. XReturns the next entry (or an array of entries) in the directory.
  788. X
  789. Xrewinddir(<DIRHANDLE>)*
  790. XPositions the directory to the beginning.
  791. X
  792. Xseekdir(<DIRHANDLE>,<POS>)
  793. XSets position for readdir on the directory.
  794. X
  795. Xtelldir(<DIRHANDLE>)*
  796. XReturns the postion in the directory.
  797. X\endtable
  798. X
  799. X\beginsection 15. Input/Output
  800. X
  801. X\text
  802. XIn input/output operations, <FILEHANDLE> may be a filehandle as
  803. Xopened by the ``open'' operator, or a scalar variable which evaluates to
  804. Xthe name of a filehandle to be used.
  805. X\medskip
  806. X
  807. X\table1.2in
  808. X
  809. X%%rjc%% MS-DOS properly capitalized
  810. Xbinmode(<FILEHANDLE>)*
  811. XArranges for the file opened on <FILEHANDLE> to be read in
  812. X``binary'' mode as opposed to ``text'' mode (MS-DOS only).
  813. X
  814. Xclose(<FILEHANDLE>)*
  815. XCloses the file or pipe associated with the file handle.
  816. X
  817. Xdbmclose(|%|<ARRAY>)*
  818. XBreaks the binding between the array and the dbm file.
  819. X
  820. Xdbmopen(|%|<ARRAY>,<DBMNAME>, <MODE>)
  821. XBinds a dbm or ndbm file to the associative array. If the database
  822. Xdoes not exist, it is created with the indicated mode.
  823. X
  824. Xeof(<FILEHANDLE>)
  825. XReturns 1 if the next read will return end of file, or if the file is not
  826. Xopen.
  827. X
  828. Xeof
  829. XReturns the eof status for the last file read.
  830. X
  831. Xeof()
  832. XIndicates eof on the pseudo file formed of the files listed on the
  833. Xcommand line.
  834. X
  835. Xfcntl(<FILEHANDLE>,<FUNCTION>,|$|<VAR>)
  836. XImplements the fcntl(2) function. This function has non-standard
  837. Xreturn values. See the manual for details.
  838. X
  839. Xfileno(<FILEHANDLE>)*
  840. XReturns the file descriptor for a given (open) file.
  841. X
  842. Xflock(<FILEHANDLE>,<OPERATION>)
  843. XCalls flock(2) on the file. <OPERATION> adds from 1 (shared), 2
  844. X(exclusive), 4 (non-blocking) or 8 (unlock).
  845. X
  846. Xgetc[(<FILEHANDLE>)*]
  847. XYields the next character from the file, or |NULL| on |EOF|. If
  848. X<FILEHANDLE> is omitted, reads from |STDIN|.
  849. X
  850. Xioctl(<FILEHANDLE>,<FUNCTION>,|$|<VAR>)
  851. Xperforms ioctl(2) on the file. This function has non-standard return
  852. Xvalues. See the manual for details.
  853. X
  854. Xopen(<FILEHANDLE>[,<FILENAME>])
  855. XOpens a file and associates it with <FILEHANDLE>. If <FILENAME>
  856. Xis omitted, the scalar variable of the same name as the
  857. X<FILEHANDLE> must contain the filename.  The filename may be
  858. Xoptionally preceded by ``|>|'', ``|>>|'' or ``|<|'' to select
  859. Xoutput/append/input mode. Default mode is input. Precede with
  860. X``|+|'' to select read/write access. Use ``|&|\dots'' to connect
  861. Xto an already
  862. Xopened filehandle. Pipes to/from commands may be opened with
  863. X``\|\dots'' and ``\dots\|'' . Open returns 1 upon success, undef otherwise,
  864. Xexcept for pipes. The parentheses may be omitted, if only a
  865. X<FILEHANDLE> is specified.
  866. X
  867. Xpipe(<READHANDLE>,<WRITEHANDLE>)
  868. XReturns a pair of connected pipes.
  869. X
  870. Xprint[([<FILEHANDLE>] <LIST>\*)*]
  871. XPrints a string or a comma-separated list of strings. If
  872. X<FILEHANDLE> is omitted, prints by default to standard output (or
  873. SHAR_EOF
  874. echo "End of perlref.tex part 1"
  875. echo "File perlref.tex is continued in part 2"
  876. echo "2" > shar3_seq_.tmp
  877. exit 0
  878. --
  879. Johan Vromans                       jv@mh.nl via internet backbones
  880. Multihouse Automatisering bv               uucp: ..!{uunet,hp4nl}!mh.nl!jv
  881. Doesburgweg 7, 2803 PL Gouda, The Netherlands  phone/fax: +31 1820 62944/62500
  882. ------------------------ "Arms are made for hugging" -------------------------
  883.