Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2908 lines
110 KiB

  1. <HTML>
  2. <HEAD>
  3. <TITLE>Rex Swain's HTMLified Perl 5 Reference Guide</TITLE>
  4. <META NAME="description" CONTENT="Perl 5 Reference Guide (in HTML)">
  5. <META NAME="keywords" CONTENT="perl, reference, summary">
  6. </HEAD>
  7. <BODY>
  8. <A NAME="top"></A>
  9. <CENTER>
  10. <H1>Rex Swain's HTMLified<BR>Perl 5 Reference Guide</H1>
  11. <P>Last updated 17 May 1997</P>
  12. <P>[ The <A HREF="http://www.pcnet.com/~rhswain/perl.html">original</A> ]
  13. &nbsp;
  14. [ <A HREF="http://www.man.ac.uk/~mbzalgd/perl/perl5-ref.html">.UK Mirror</A>
  15. via <A HREF="http://www.man.ac.uk/~mbzalgd">Alain Deckers</A> ]
  16. &nbsp;
  17. [ <A HREF="http://www.cs.uni-magdeburg.de/docs/perl5/index.html">.DE Mirror</A>
  18. via <A HREF="http://irb.cs.uni-magdeburg.de/~elkner">Jens Elkner</A> ]
  19. </P>
  20. </CENTER>
  21. <H4 ALIGN=center>Jump to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  22. <CENTER>
  23. <TABLE BORDER=4 CELLPADDING=8><TR><TD>
  24. <CENTER>
  25. <H3><FONT COLOR="#FF0000">Please make a local copy of this HTML document!</FONT></H3>
  26. <P>Use your browser's <STRONG><U>F</U>ile, Save <U>A</U>s...</STRONG> command
  27. <BR>or I will get charged by my ISP for excessive bandwidth use.</P>
  28. Thank you!
  29. </CENTER>
  30. </TR></TD></TABLE>
  31. </CENTER>
  32. <P>This is an HTMLified version of the <I>Perl 5 Desktop Reference</I>,
  33. ISBN 1-56592-187-9, copyright &copy; 1996 by
  34. <A HREF="http://www.xs4all.nl/~jvromans/">Johan Vromans</A>.
  35. HTML copyright &copy; 1996-1997 by
  36. <A HREF="http://www.pcnet.com/~rhswain/">Rex Swain</A>.</P>
  37. <P>See <A HREF="http://www.pcnet.com/~rhswain/perl4.html">Rex Swain's HTMLified Perl 4 Reference Guide</A>
  38. for similar summary of Perl version 4.</P>
  39. <P>See <A HREF="http://www.ora.com/catalog/perlqr/">Perl 5 Desktop Reference</A>
  40. for information about ordering a printed copy ($6.95) of the booklet from O'Reilly.
  41. See <A HREF="http://www.xs4all.nl/~jvromans/perlref.html">The Perl Reference Guide</A>
  42. for pointers to a PostScript (free) version.</P>
  43. <P>If you want to learn Perl, see the book
  44. <A HREF="http://www.ora.com/catalog/lperl/">Learning Perl</A>
  45. by Randal L. Schwartz. If you want more detailed information about Perl, see the book
  46. <A HREF="http://www.ora.com/catalog/pperl/">Programming perl</A>
  47. by Larry Wall and Randal L. Schwartz.</P>
  48. <P>For more detail, see <A HREF="http://www.mit.edu/perl/perl.html">Perl Manual</A>
  49. or <A HREF="ftp://ftp.digital.com/pub/plan/perl/CPAN/doc/manual/html/perlfunc.html#perlfunc_alphabetical_0">Alphabetical Listing of Perl Functions</A>.
  50. <BR>For less detail, see <A HREF="http://www.perl.com/perl/">The Perl Language Home Page</A>.</P>
  51. <H4 ALIGN=center>Jump to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  52. <!-- ----------------------------------------------------------------------------- -->
  53. <A NAME="contents"></A>
  54. <H2>Contents</H2>
  55. <TABLE>
  56. <TR><TD><UL>
  57. <LI><A HREF="#conventions">Conventions</A>
  58. </UL></TD></TR>
  59. <TR><TD><UL>
  60. <LI><A HREF="#options">Command-Line Options</A>
  61. <LI><A HREF="#literals">Literals</A>
  62. <LI><A HREF="#variables">Variables</A>
  63. <LI><A HREF="#operators">Operators</A>
  64. <LI><A HREF="#statements">Statements</A>
  65. <LI><A HREF="#subroutines">Subroutines, Packages and Modules</A>
  66. <LI><A HREF="#object">Object-Oriented Programming</A>
  67. <LI><A HREF="#arithmetic">Arithmetic Functions</A>
  68. <LI><A HREF="#conversion">Conversion Functions</A>
  69. <LI><A HREF="#structure">Structure Conversion</A>
  70. <LI><A HREF="#string">String Functions</A>
  71. <LI><A HREF="#array">Array and List Functions</A>
  72. <LI><A HREF="#regular">Regular Expressions</A>
  73. <LI><A HREF="#search">Search and Replace Functions</A>
  74. </UL></TD>
  75. <TD><UL>
  76. <LI><A HREF="#filetest">File Test Operators</A>
  77. <LI><A HREF="#fileoperations">File Operations</A>
  78. <LI><A HREF="#input">Input / Output</A>
  79. <LI><A HREF="#formats">Formats</A>
  80. <LI><A HREF="#directory">Directory Reading Routines</A>
  81. <LI><A HREF="#systeminteraction">System Interaction</A>
  82. <LI><A HREF="#networking">Networking</A>
  83. <LI><A HREF="#systemv">System V IPC</A>
  84. <LI><A HREF="#miscellaneous">Miscellaneous</A>
  85. <LI><A HREF="#information">Information from System Files</A>
  86. <LI><A HREF="#specialvariables">Special Variables</A>
  87. <LI><A HREF="#specialarrays">Special Arrays</A>
  88. <LI><A HREF="#environment">Environment Variables</A>
  89. <LI><A HREF="#debugger">The Perl Debugger</A>
  90. </UL></TD></TR>
  91. </TABLE>
  92. <H4 ALIGN=center>Jump to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  93. <!-- ----------------------------------------------------------------------------- -->
  94. <A NAME="index"></A>
  95. <H2>Index</H2>
  96. <A HREF="#arithmetic">abs</A>&nbsp;
  97. <A HREF="#networking">accept</A>&nbsp;
  98. <A HREF="#systeminteraction">alarm</A>&nbsp;
  99. <A HREF="#operators">and</A>&nbsp;
  100. <A HREF="#specialarrays">ARGV</A>&nbsp;
  101. <A HREF="#arithmetic">ArithmeticFunctions</A>&nbsp;
  102. <A HREF="#array">ArrayListFunctions</A>&nbsp;
  103. <A HREF="#specialarrays">ArraysSpecial</A>&nbsp;
  104. <A HREF="#arithmetic">atan2</A>&nbsp;
  105. <A HREF="#subroutines">BEGIN</A>&nbsp;
  106. <A HREF="#networking">bind</A>&nbsp;
  107. <A HREF="#input">binmode</A>&nbsp;
  108. <A HREF="#subroutines">bless</A>&nbsp;
  109. <A HREF="#subroutines">caller</A>&nbsp;
  110. <A HREF="#systeminteraction">chdir</A>&nbsp;
  111. <A HREF="#fileoperations">chmod</A>&nbsp;
  112. <A HREF="#string">chomp</A>&nbsp;
  113. <A HREF="#string">chop</A>&nbsp;
  114. <A HREF="#conversion">chr</A>&nbsp;
  115. <A HREF="#systeminteraction">chroot</A>&nbsp;
  116. <A HREF="#input">close</A>&nbsp;
  117. <A HREF="#directory">closedir</A>&nbsp;
  118. <A HREF="#operators">cmp</A>&nbsp;
  119. <A HREF="#options">CommandLineOptions</A>&nbsp;
  120. <A HREF="#networking">connect</A>&nbsp;
  121. <A HREF="#contents">Contents</A>&nbsp;
  122. <A HREF="#statements">continue</A>&nbsp;
  123. <A HREF="#conventions">Conventions</A>&nbsp;
  124. <A HREF="#conversion">ConversionFunctions</A>&nbsp;
  125. <A HREF="#structure">ConversionStructure</A>&nbsp;
  126. <A HREF="#arithmetic">cos</A>&nbsp;
  127. <A HREF="#string">crypt</A>&nbsp;
  128. <A HREF="#input">dbmclose</A>&nbsp;
  129. <A HREF="#input">dbmopen</A>&nbsp;
  130. <A HREF="#debugger">Debugger</A>&nbsp;
  131. <A HREF="#miscellaneous">defined</A>&nbsp;
  132. <A HREF="#array">delete</A>&nbsp;
  133. <A HREF="#systeminteraction">die</A>&nbsp;
  134. <A HREF="#directory">DirectoryReadingRoutines</A>&nbsp;
  135. <A HREF="#statements">do</A>&nbsp;
  136. <A HREF="#subroutines">do</A>&nbsp;
  137. <A HREF="#miscellaneous">do</A>&nbsp;
  138. <A HREF="#miscellaneous">dump</A>&nbsp;
  139. <A HREF="#array">each</A>&nbsp;
  140. <A HREF="#statements">else</A>&nbsp;
  141. <A HREF="#statements">elsif</A>&nbsp;
  142. <A HREF="#subroutines">END</A>&nbsp;
  143. <A HREF="#specialarrays">ENV</A>&nbsp;
  144. <A HREF="#environment">EnvironmentVariables</A>&nbsp;
  145. <A HREF="#input">eof</A>&nbsp;
  146. <A HREF="#operators">eq</A>&nbsp;
  147. <A HREF="#string">eval</A>&nbsp;
  148. <A HREF="#miscellaneous">eval</A>&nbsp;
  149. <A HREF="#systeminteraction">exec</A>&nbsp;
  150. <A HREF="#array">exists</A>&nbsp;
  151. <A HREF="#systeminteraction">exit</A>&nbsp;
  152. <A HREF="#arithmetic">exp</A>&nbsp;
  153. <A HREF="#specialarrays">EXPORT</A>&nbsp;
  154. <A HREF="#specialarrays">EXPORT_OK</A>&nbsp;
  155. <A HREF="#regular">ExpressionsRegular</A>&nbsp;
  156. <A HREF="#input">fcntl</A>&nbsp;
  157. <A HREF="#input">fileno</A>&nbsp;
  158. <A HREF="#fileoperations">FileOperations</A>&nbsp;
  159. <A HREF="#information">FilesSystemInformationFrom</A>&nbsp;
  160. <A HREF="#filetest">FileTestOperators</A>&nbsp;
  161. <A HREF="#input">flock</A>&nbsp;
  162. <A HREF="#statements">for</A>&nbsp;
  163. <A HREF="#statements">foreach</A>&nbsp;
  164. <A HREF="#systeminteraction">fork</A>&nbsp;
  165. <A HREF="#formats">Formats</A>&nbsp;
  166. <A HREF="#formats">formline</A>&nbsp;
  167. <A HREF="#arithmetic">FunctionsArithmetic</A>&nbsp;
  168. <A HREF="#array">FunctionsArrayList</A>&nbsp;
  169. <A HREF="#conversion">FunctionsConversion</A>&nbsp;
  170. <A HREF="#search">FunctionsSearchReplace</A>&nbsp;
  171. <A HREF="#string">FunctionsString</A>&nbsp;
  172. <A HREF="#operators">ge</A>&nbsp;
  173. <A HREF="#input">getc</A>&nbsp;
  174. <A HREF="#systeminteraction">getlogin</A>&nbsp;
  175. <A HREF="#networking">getpeername</A>&nbsp;
  176. <A HREF="#systeminteraction">getpgrp</A>&nbsp;
  177. <A HREF="#systeminteraction">getppid</A>&nbsp;
  178. <A HREF="#systeminteraction">getpriority</A>&nbsp;
  179. <A HREF="#networking">getsockname</A>&nbsp;
  180. <A HREF="#networking">getsockopt</A>&nbsp;
  181. <A HREF="#systeminteraction">glob</A>&nbsp;
  182. <A HREF="#conversion">gmtime</A>&nbsp;
  183. <A HREF="#statements">goto</A>&nbsp;
  184. <A HREF="#subroutines">goto</A>&nbsp;
  185. <A HREF="#array">grep</A>&nbsp;
  186. <A HREF="#operators">gt</A>&nbsp;
  187. <A HREF="#conversion">hex</A>&nbsp;
  188. <A HREF="#environment">HOME</A>&nbsp;
  189. <A HREF="#statements">if</A>&nbsp;
  190. <A HREF="#subroutines">import</A>&nbsp;
  191. <A HREF="#specialarrays">INC</A>&nbsp;
  192. <A HREF="#index">Index</A>&nbsp;
  193. <A HREF="#string">index</A>&nbsp;
  194. <A HREF="#information">InformationFromSystemFiles</A>&nbsp;
  195. <A HREF="#input">InputOutput</A>&nbsp;
  196. <A HREF="#arithmetic">int</A>&nbsp;
  197. <A HREF="#systeminteraction">InteractionSystem</A>&nbsp;
  198. <A HREF="#input">ioctl</A>&nbsp;
  199. <A HREF="#specialarrays">ISA</A>&nbsp;
  200. <A HREF="#array">join</A>&nbsp;
  201. <A HREF="#array">keys</A>&nbsp;
  202. <A HREF="#systeminteraction">kill</A>&nbsp;
  203. <A HREF="#statements">last</A>&nbsp;
  204. <A HREF="#string">lc</A>&nbsp;
  205. <A HREF="#string">lcfirst</A>&nbsp;
  206. <A HREF="#operators">le</A>&nbsp;
  207. <A HREF="#string">length</A>&nbsp;
  208. <A HREF="#fileoperations">link</A>&nbsp;
  209. <A HREF="#array">ListArrayFunctions</A>&nbsp;
  210. <A HREF="#networking">listen</A>&nbsp;
  211. <A HREF="#literals">Literals</A>&nbsp;
  212. <A HREF="#miscellaneous">local</A>&nbsp;
  213. <A HREF="#conversion">localtime</A>&nbsp;
  214. <A HREF="#arithmetic">log</A>&nbsp;
  215. <A HREF="#environment">LOGDIR</A>&nbsp;
  216. <A HREF="#fileoperations">lstat</A>&nbsp;
  217. <A HREF="#operators">lt</A>&nbsp;
  218. <A HREF="#search">m</A>&nbsp;
  219. <A HREF="#array">map</A>&nbsp;
  220. <A HREF="#miscellaneous">Miscellaeous</A>&nbsp;
  221. <A HREF="#fileoperations">mkdir</A>&nbsp;
  222. <A HREF="#subroutines">Modules</A>&nbsp;
  223. <A HREF="#miscellaneous">my</A>&nbsp;
  224. <A HREF="#operators">ne</A>&nbsp;
  225. <A HREF="#networking">Networking</A>&nbsp;
  226. <A HREF="#statements">next</A>&nbsp;
  227. <A HREF="#subroutines">no</A>&nbsp;
  228. <A HREF="#operators">npt</A>&nbsp;
  229. <A HREF="#object">ObjectOrientedProgramming</A>&nbsp;
  230. <A HREF="#conversion">oct</A>&nbsp;
  231. <A HREF="#input">open</A>&nbsp;
  232. <A HREF="#directory">opendir</A>&nbsp;
  233. <A HREF="#fileoperations">OperationsFile</A>&nbsp;
  234. <A HREF="#operators">Operators</A>&nbsp;
  235. <A HREF="#filetest">OperatorsFileTest</A>&nbsp;
  236. <A HREF="#options">OptionsCommandLine</A>&nbsp;
  237. <A HREF="#operators">or</A>&nbsp;
  238. <A HREF="#conversion">ord</A>&nbsp;
  239. <A HREF="#input">OutputInput</A>&nbsp;
  240. <A HREF="#specialarrays">OVERLOAD</A>&nbsp;
  241. <A HREF="#structure">pack</A>&nbsp;
  242. <A HREF="#subroutines">package</A>&nbsp;
  243. <A HREF="#subroutines">Packages</A>&nbsp;
  244. <A HREF="#environment">PATH</A>&nbsp;
  245. <A HREF="#environment">PERL5DB</A>&nbsp;
  246. <A HREF="#environment">PERL5LIB</A>&nbsp;
  247. <A HREF="#environment">PERLLIB</A>&nbsp;
  248. <A HREF="#input">pipe</A>&nbsp;
  249. <A HREF="#array">pop</A>&nbsp;
  250. <A HREF="#search">pos</A>&nbsp;
  251. <A HREF="#input">print</A>&nbsp;
  252. <A HREF="#input">printf</A>&nbsp;
  253. <A HREF="#array">push</A>&nbsp;
  254. <A HREF="#string">quotemeta</A>&nbsp;
  255. <A HREF="#arithmetic">rand</A>&nbsp;
  256. <A HREF="#input">read</A>&nbsp;
  257. <A HREF="#directory">readdir</A>&nbsp;
  258. <A HREF="#directory">ReadingDirectoryRoutines</A>&nbsp;
  259. <A HREF="#fileoperations">readlink</A>&nbsp;
  260. <A HREF="#networking">recv</A>&nbsp;
  261. <A HREF="#statements">redo</A>&nbsp;
  262. <A HREF="#miscellaneous">ref</A>&nbsp;
  263. <A HREF="#regular">RegularExpressions</A>&nbsp;
  264. <A HREF="#fileoperations">rename</A>&nbsp;
  265. <A HREF="#search">ReplaceSearchFunctions</A>&nbsp;
  266. <A HREF="#subroutines">require</A>&nbsp;
  267. <A HREF="#miscellaneous">reset</A>&nbsp;
  268. <A HREF="#subroutines">return</A>&nbsp;
  269. <A HREF="#array">reverse</A>&nbsp;
  270. <A HREF="#directory">rewindir</A>&nbsp;
  271. <A HREF="#string">rindex</A>&nbsp;
  272. <A HREF="#fileoperations">rmdir</A>&nbsp;
  273. <A HREF="#directory">RoutinesDirectoryReading</A>&nbsp;
  274. <A HREF="#search">s</A>&nbsp;
  275. <A HREF="#array">scalar</A>&nbsp;
  276. <A HREF="#miscellaneous">scalar</A>&nbsp;
  277. <A HREF="#search">SearchReplaceFunctions</A>&nbsp;
  278. <A HREF="#input">seek</A>&nbsp;
  279. <A HREF="#directory">seekdir</A>&nbsp;
  280. <A HREF="#input">select</A>&nbsp;
  281. <A HREF="#networking">send</A>&nbsp;
  282. <A HREF="#systeminteraction">setpgrp</A>&nbsp;
  283. <A HREF="#systeminteraction">setpriority</A>&nbsp;
  284. <A HREF="#networking">setsockopt</A>&nbsp;
  285. <A HREF="#array">shift</A>&nbsp;
  286. <A HREF="#networking">shutdown</A>&nbsp;
  287. <A HREF="#specialarrays">SIG</A>&nbsp;
  288. <A HREF="#arithmetic">sin</A>&nbsp;
  289. <A HREF="#systeminteraction">sleep</A>&nbsp;
  290. <A HREF="#networking">socket</A>&nbsp;
  291. <A HREF="#networking">socketpair</A>&nbsp;
  292. <A HREF="#array">sort</A>&nbsp;
  293. <A HREF="#specialarrays">SpecialArrays</A>&nbsp;
  294. <A HREF="#specialvariables">SpecialVariables</A>&nbsp;
  295. <A HREF="#array">splice</A>&nbsp;
  296. <A HREF="#array">split</A>&nbsp;
  297. <A HREF="#input">sprintf</A>&nbsp;
  298. <A HREF="#arithmetic">sqrt</A>&nbsp;
  299. <A HREF="#arithmetic">srand</A>&nbsp;
  300. <A HREF="#fileoperations">stat</A>&nbsp;
  301. <A HREF="#statements">Statements</A>&nbsp;
  302. <A HREF="#string">StringFunctions</A>&nbsp;
  303. <A HREF="#structure">StructureConversion</A>&nbsp;
  304. <A HREF="#search">study</A>&nbsp;
  305. <A HREF="#subroutines">sub</A>&nbsp;
  306. <A HREF="#subroutines">Subroutines</A>&nbsp;
  307. <A HREF="#string">substr</A>&nbsp;
  308. <A HREF="#fileoperations">symlink</A>&nbsp;
  309. <A HREF="#systeminteraction">syscall</A>&nbsp;
  310. <A HREF="#input">sysread</A>&nbsp;
  311. <A HREF="#systeminteraction">system</A>&nbsp;
  312. <A HREF="#information">SystemFilesInformationFrom</A>&nbsp;
  313. <A HREF="#systeminteraction">SystemInteraction</A>&nbsp;
  314. <A HREF="#systemv">SystemVIPC</A>&nbsp;
  315. <A HREF="#input">syswrite</A>&nbsp;
  316. <A HREF="#input">tell</A>&nbsp;
  317. <A HREF="#directory">telldir</A>&nbsp;
  318. <A HREF="#filetest">TestFileOperators</A>&nbsp;
  319. <A HREF="#subroutines">tie</A>&nbsp;
  320. <A HREF="#arithmetic">time</A>&nbsp;
  321. <A HREF="#systeminteraction">times</A>&nbsp;
  322. <A HREF="#search">tr</A>&nbsp;
  323. <A HREF="#fileoperations">truncate</A>&nbsp;
  324. <A HREF="#string">uc</A>&nbsp;
  325. <A HREF="#string">ucfirst</A>&nbsp;
  326. <A HREF="#systeminteraction">umask</A>&nbsp;
  327. <A HREF="#miscellaneous">undef</A>&nbsp;
  328. <A HREF="#statements">unless</A>&nbsp;
  329. <A HREF="#fileoperations">unlink</A>&nbsp;
  330. <A HREF="#structure">unpack</A>&nbsp;
  331. <A HREF="#array">unshift</A>&nbsp;
  332. <A HREF="#subroutines">untie</A>&nbsp;
  333. <A HREF="#statements">until</A>&nbsp;
  334. <A HREF="#statements">until</A>&nbsp;
  335. <A HREF="#subroutines">use</A>&nbsp;
  336. <A HREF="#fileoperations">utime</A>&nbsp;
  337. <A HREF="#array">values</A>&nbsp;
  338. <A HREF="#variables">Variables</A>&nbsp;
  339. <A HREF="#environment">VariablesEnvironment</A>&nbsp;
  340. <A HREF="#specialvariables">VariablesSpecial</A>&nbsp;
  341. <A HREF="#conversion">vec</A>&nbsp;
  342. <A HREF="#systeminteraction">wait</A>&nbsp;
  343. <A HREF="#systeminteraction">waitpid</A>&nbsp;
  344. <A HREF="#miscellaneous">wantarray</A>&nbsp;
  345. <A HREF="#systeminteraction">warn</A>&nbsp;
  346. <A HREF="#statements">while</A>&nbsp;
  347. <A HREF="#formats">write</A>&nbsp;
  348. <A HREF="#operators">xor</A>&nbsp;
  349. <A HREF="#search">y</A>&nbsp;
  350. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  351. <!-- ----------------------------------------------------------------------------- -->
  352. <A NAME="conventions"></A>
  353. <H2>Conventions</H2>
  354. <TABLE CELLSPACING=0 CELLPADDING=0>
  355. <TR>
  356. <TD><TT><B>fixed&nbsp;&nbsp;</B></TT></TD>
  357. <TD>denotes literal text.</TD>
  358. </TR>
  359. <TR>
  360. <TD><FONT SIZE="-1">THIS</FONT></TD>
  361. <TD>means variable text, i.e., things you must fill in.</TD>
  362. </TR>
  363. <TR>
  364. <TD><FONT SIZE="-1">THIS&#134;</FONT></TD>
  365. <TD>means that <FONT SIZE="-1">THIS</FONT> will default to <TT><B>$_</B></TT> if omitted.</TD>
  366. </TR>
  367. <TR>
  368. <TD><B>word</B></TD>
  369. <TD>is a keyword, i.e., a word with a special meaning.</TD>
  370. </TR>
  371. <TR>
  372. <TD><FONT SIZE="-1">RETURN key&nbsp;&nbsp;</FONT></TD>
  373. <TD>denotes pressing a keyboard key.</TD>
  374. </TR>
  375. <TR>
  376. <TD>[...]</TD>
  377. <TD>denotes an optional part.</TD>
  378. </TR>
  379. </TABLE>
  380. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  381. <!-- ----------------------------------------------------------------------------- -->
  382. <A NAME="options"></A>
  383. <H2>Command-Line Options</H2>
  384. <DL COMPACT>
  385. <DT><TT><B>-a</B></TT>
  386. <DD>turns on autosplit mode when used with <TT><B>-n</B></TT> or <TT><B>-p</B></TT>.
  387. Splits to <TT><B>@F</B></TT>.
  388. <DT><TT><B>-c</B></TT>
  389. <DD>checks syntax but does not execute.
  390. <DT><TT><B>-d</B></TT>
  391. <DD>runs the script under the debugger.
  392. Use <TT><B>-de 0</B></TT> to start the debugger without a script
  393. <DT><TT><B>-D</B></TT> <FONT SIZE="-1">NUMBER</FONT>
  394. <DD>sets debugging flags.
  395. <DT><TT><B>-e</B></TT> <FONT SIZE="-1">COMMANDLINE</FONT>
  396. <DD>may be used to enter a single line of script.
  397. Multiple <TT><B>-e</B></TT> commands may be given to build up a multiline script.
  398. <DT><TT><B>-F</B></TT> <FONT SIZE="-1">REGEXP</FONT>
  399. <DD>specifies a regular expression to split on
  400. if <TT><B>-a</B></TT> is in effect.
  401. <DT><TT><B>-i</B></TT><FONT SIZE="-1">EXT</FONT>
  402. <DD>files processed by the <TT><B>&lt; &gt;</B></TT> construct are
  403. to be edited in place.
  404. <DT><TT><B>-I</B></TT><FONT SIZE="-1">DIR</FONT>
  405. <DD>with <TT><B>-P</B></TT>, tells the C preprocessor where to look for include files.
  406. The directory is prepended to <TT><B>@INC</B></TT>.
  407. <DT><TT><B>-l</B></TT> [<FONT SIZE="-1">OCTNUM</FONT>]
  408. <DD>enables automatic line-end processing, e.g., <TT><B>-l013</B></TT>.
  409. <DT><TT><B>-n</B></TT>
  410. <DD>assumes an input loop around your script. Lines are not printed.
  411. <DT><TT><B>-p</B></TT>
  412. <DD>assumes an input loop around your script. Lines are printed.
  413. <DT><TT><B>-P</B></TT>
  414. <DD>runs the C preprocessor on the script before compilation by Perl.
  415. <DT><TT><B>-s</B></TT>
  416. <DD>interprets <TT><B>-xxx</B></TT> on the command line as a switch and sets
  417. the corresponding variable <TT><B>$xxx</B></TT> in the script.
  418. <DT><TT><B>-S</B></TT>
  419. <DD>uses the <TT><B>PATH</B></TT> environment variable to search for the script.
  420. <DT><TT><B>-T</B></TT>
  421. <DD>forces taint checking.
  422. <DT><TT><B>-u</B></TT>
  423. <DD>dumps core after compiling the script. To be used with the <I>undump</I>(1)
  424. program (where available).
  425. <DT><TT><B>-U</B></TT>
  426. <DD>allows perl to perform unsafe operations.
  427. <DT><TT><B>-v</B></TT>
  428. <DD>prints the version and patchlevel of your Perl executable.
  429. <DT><TT><B>-w</B></TT>
  430. <DD>prints warnings about possible spelling errors and other error-prone
  431. constructs in the script.
  432. <DT><TT><B>-x</B></TT> [<FONT SIZE="-1">DIR</FONT>]
  433. <DD>extracts Perl program from input stream.
  434. If <FONT SIZE="-1">DIR</FONT> is specified,
  435. switches to this directory before running the program.
  436. <DT><TT><B>-0</B></TT><FONT SIZE="-1">VAL</FONT>
  437. <DD>(that's the number zero.) Designates an initial value for the record
  438. separator <TT><B>$/</B></TT>. See also <TT><B>-l</B></TT>
  439. </DL>
  440. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  441. <!-- ----------------------------------------------------------------------------- -->
  442. <A NAME="literals"></A>
  443. <H2>Literals</H2>
  444. <DL>
  445. <DT>Numeric:
  446. <DD><TT><B>123</B></TT>
  447. <DD><TT><B>1_234</B></TT>
  448. <DD><TT><B>123.4</B></TT>
  449. <DD><TT><B>5E-10</B></TT>
  450. <DD><TT><B>0xff</B></TT> (hex)
  451. <DD><TT><B>0377</B></TT> (octal)
  452. <DT>String:
  453. <DL>
  454. <DT><TT><B>'abc'</B></TT>
  455. <DD>literal string, no variable interpolation or escape characters,
  456. except <TT><B>\'</B></TT> and <TT><B>\\</B></TT>.
  457. Also: <TT><B>q/abc/</B></TT>.
  458. Almost any pair of delimiters can be used instead of <TT><B>/</B></TT>...<TT><B>/</B></TT>.
  459. <DT><TT><B>"abc"</B></TT>
  460. <DD>Variables are interpolated and escape sequences are processed.
  461. Also: <TT><B>qq/abc/</B></TT>.
  462. <BR>Escape sequences:
  463. <TT><B>\t</B></TT> (Tab),
  464. <TT><B>\n</B></TT> (Newline),
  465. <TT><B>\r</B></TT> (Return),
  466. <TT><B>\f</B></TT> (Formfeed),
  467. <TT><B>\b</B></TT> (Backspace),
  468. <TT><B>\a</B></TT> (Alarm),
  469. <TT><B>\e</B></TT> (Escape),
  470. <TT><B>\033</B></TT> (octal),
  471. <TT><B>\x1b</B></TT> (hex),
  472. <TT><B>\c[</B></TT> (control)
  473. <BR><TT><B>\l</B></TT> and <TT><B>\u</B></TT> lowercase/uppercase the following character.
  474. <TT><B>\L</B></TT> and <TT><B>\U</B></TT> lowercase/uppercase until a <TT><B>\E</B></TT>
  475. is encountered.
  476. <TT><B>\Q</B></TT> quote regular expression characters until a <TT><B>\E</B></TT>
  477. is encountered.
  478. <DT><TT><B>`</B></TT><FONT SIZE="-1">COMMAND</FONT><TT><B>`</B></TT>
  479. <DD>evaluates to the output of the <FONT SIZE="-1">COMMAND</FONT>.
  480. Also: <TT><B>qx/</B></TT><FONT SIZE="-1">COMMAND</FONT><TT><B>/</B></TT>.
  481. </DL>
  482. <DT>Array:
  483. <DD><TT><B>(1, 2, 3)</B></TT>. <TT><B>()</B></TT> is an empty array.
  484. <BR><TT><B>(1..4)</B></TT> is the same as <TT><B>(1,2,3,4)</B></TT>,
  485. <BR>likewise <TT><B>('a'..'z')</B></TT>.
  486. <BR><TT><B>qw/foo bar </B></TT>...<TT><B>/</B></TT> is the same as <TT><B>('foo','bar',</B></TT>...<TT><B>)</B></TT>.
  487. <DT>Array reference:
  488. <DD><TT><B>[1,2,3]</B></TT>
  489. <DT>Hash (associative array):
  490. <DD><TT><B>(</B></TT><FONT SIZE="-1">KEY1</FONT><TT><B>,</B></TT>
  491. <FONT SIZE="-1">VAL1</FONT><TT><B>,</B></TT>
  492. <FONT SIZE="-1">KEY2</FONT><TT><B>,</B></TT>
  493. <FONT SIZE="-1">VAL2</FONT><TT><B>,</B></TT>...<TT><B>)</B></TT>
  494. <BR>Also
  495. <TT><B>(</B></TT><FONT SIZE="-1">KEY1</FONT><TT><B>=&gt;</B></TT>
  496. <FONT SIZE="-1">VAL1</FONT><TT><B>,</B></TT>
  497. <FONT SIZE="-1">KEY2</FONT><TT><B>=&gt;</B></TT>
  498. <FONT SIZE="-1">VAL2</FONT><TT><B>,</B></TT>...<TT><B>)</B></TT>
  499. <DT>Hash reference:
  500. <DD><TT><B>{</B></TT><FONT SIZE="-1">KEY1</FONT><TT><B>,</B></TT>
  501. <FONT SIZE="-1">VAL1</FONT><TT><B>,</B></TT>
  502. <FONT SIZE="-1">KEY2</FONT><TT><B>,</B></TT>
  503. <FONT SIZE="-1">VAL2</FONT><TT><B>,</B></TT>...<TT><B>}</B></TT>
  504. <DT>Code reference:
  505. <DD><B>sub</B> <TT><B>{</B></TT><FONT SIZE="-1">STATEMENTS</FONT><TT><B>}</B></TT>
  506. <DT>Filehandles:
  507. <DD>
  508. <TT><B>&lt;STDIN&gt;</B></TT>,
  509. <TT><B>&lt;STDOUT&gt;</B></TT>,
  510. <TT><B>&lt;STDERR&gt;</B></TT>,
  511. <TT><B>&lt;ARGV&gt;</B></TT>,
  512. <TT><B>&lt;DATA&gt;</B></TT>.
  513. <BR>User-specified:
  514. <FONT SIZE="-1">HANDLE</FONT>,
  515. <TT><B>$</B></TT><FONT SIZE="-1">VAR</FONT>.
  516. <DT>Globs:
  517. <DD><TT><B>&lt;</B></TT><FONT SIZE="-1">PATTERN</FONT><TT><B>&gt;</B></TT>
  518. evaluates to all filenames according to the pattern.
  519. Use <TT><B>&lt;${</B></TT><FONT SIZE="-1">VAR</FONT><TT><B>}&gt;</B></TT>
  520. or <B>glob</B>&nbsp;<TT><B>$</B></TT><FONT SIZE="-1">VAR</FONT>
  521. to glob from a variable.
  522. <DT>Here-Is:
  523. <DD><TT><B>&lt;&lt;</B></TT><FONT SIZE="-1">IDENTIFIER</FONT>
  524. <BR>Shell-style "here document."
  525. <DT>Special tokens:
  526. <DD><TT><B>__FILE__</B></TT>: filename;
  527. <TT><B>__LINE__</B></TT>: line number;
  528. <TT><B>__END__</B></TT>: end of program;
  529. remaining lines can be read using the filehandle <TT><B>DATA</B></TT>.
  530. </DL>
  531. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  532. <!-- ----------------------------------------------------------------------------- -->
  533. <A NAME="variables"></A>
  534. <H2>Variables</H2>
  535. <TABLE CELLSPACING=0 CELLPADDING=0>
  536. <TR>
  537. <TD VALIGN=top><TT><B>$var</B></TT></TD>
  538. <TD VALIGN=top>a simple scalar variable.</TD>
  539. </TR>
  540. <TR>
  541. <TD VALIGN=top><TT><B>$var[28]</B></TT></TD>
  542. <TD VALIGN=top>29th element of array <TT><B>@var</B></TT>.</TD>
  543. </TR>
  544. <TR>
  545. <TD VALIGN=top><TT><B>$p = \@var</B></TT></TD>
  546. <TD VALIGN=top>now <TT><B>$p</B></TT> is a reference to array <TT><B>@var</B></TT>.</TD>
  547. </TR>
  548. <TR>
  549. <TD VALIGN=top><TT><B>$$p[28]</B></TT></TD>
  550. <TD VALIGN=top>29th element of array referenced by <TT><B>$p</B></TT>.
  551. <BR>Also, <TT><B>$p-&gt;[28]</B></TT>.</TD>
  552. </TR>
  553. <TR>
  554. <TD VALIGN=top><TT><B>$var[-1]</B></TT></TD>
  555. <TD VALIGN=top>last element of array <TT><B>@var</B></TT>.</TD>
  556. </TR>
  557. <TR>
  558. <TD VALIGN=top><TT><B>$var[$i][$j]</B></TT></TD>
  559. <TD VALIGN=top><TT><B>$j</B></TT>th element of the <TT><B>$i</B></TT>th element of
  560. array <TT><B>@var</B></TT>.</TD>
  561. </TR>
  562. <TR>
  563. <TD VALIGN=top><TT><B>$var{'Feb'}</B></TT></TD>
  564. <TD VALIGN=top>one value from hash (associative array) <TT><B>%var</B></TT>.</TD>
  565. </TR>
  566. <TR>
  567. <TD VALIGN=top><TT><B>$p = \%var</B></TT></TD>
  568. <TD VALIGN=top>now <TT><B>$p</B></TT> is a reference to hash <TT><B>%var</B></TT>.</TD>
  569. </TR>
  570. <TR>
  571. <TD VALIGN=top><TT><B>$$p{'Feb'}</B></TT></TD>
  572. <TD VALIGN=top>a value from hash referenced by <TT><B>$p</B></TT>.
  573. <BR>Also, <TT><B>$p-&gt;{'Feb'}</B></TT>.</TD>
  574. </TR>
  575. <TR>
  576. <TD VALIGN=top><TT><B>$#var</B></TT></TD>
  577. <TD VALIGN=top>last index of array <TT><B>@var</B></TT>.</TD>
  578. </TR>
  579. <TR>
  580. <TD VALIGN=top><TT><B>@var</B></TT></TD>
  581. <TD VALIGN=top>the entire array;
  582. in a scalar context, the number of elements in the array.</TD>
  583. </TR>
  584. <TR>
  585. <TD VALIGN=top><TT><B>@var[3,4,5]</B></TT></TD>
  586. <TD VALIGN=top>a slice of array <TT><B>@var</B></TT>.</TD>
  587. </TR>
  588. <TR>
  589. <TD VALIGN=top><TT><B>@var{'a','b'}</B></TT></TD>
  590. <TD VALIGN=top>a slice of <TT><B>%var</B></TT>;
  591. same as <TT><B>($var{'a'},$var{'b'})</B></TT>.</TD>
  592. </TR>
  593. <TR>
  594. <TD VALIGN=top><TT><B>%var</B></TT></TD>
  595. <TD VALIGN=top>the entire hash;
  596. in a scalar context, <B>true</B> if the hash has elements.</TD>
  597. </TR>
  598. <TR>
  599. <TD VALIGN=top><TT><B>$var{'a',1,</B></TT>...<TT><B>}</B></TT></TD>
  600. <TD VALIGN=top>emulates a multidimensional array.</TD>
  601. </TR>
  602. <TR>
  603. <TD VALIGN=top><TT><B>('a'</B></TT>...<TT><B>'z')[4,7,9]</B></TT></TD>
  604. <TD VALIGN=top>a slice of an array literal.</TD>
  605. </TR>
  606. <TR>
  607. <TD VALIGN=top><FONT SIZE="-1">PKG</FONT><TT><B>::</B></TT><FONT SIZE="-1">VAR</FONT></TD>
  608. <TD VALIGN=top>a variable from a package, e.g.,
  609. <TT><B>$pkg::var</B></TT>, <TT><B>@pkg::ary</B></TT>.</TD>
  610. </TR>
  611. <TR>
  612. <TD VALIGN=top><TT><B>\</B></TT><FONT SIZE="-1">OBJECT</FONT></TD>
  613. <TD VALIGN=top>reference to an object, e.g.,
  614. <TT><B>\$var</B></TT>, <TT><B>\%hash</B></TT>.</TD>
  615. </TR>
  616. <TR>
  617. <TD VALIGN=top><TT><B>*</B></TT><FONT SIZE="-1">NAME</FONT></TD>
  618. <TD VALIGN=top>refers to all objects represented by <FONT SIZE="-1">NAME</FONT>.
  619. <BR><TT><B>*n1 = *n2</B></TT> makes <TT><B>n1</B></TT> an alias for <TT><B>n2</B></TT>.
  620. <BR><TT><B>*n1 = $n2</B></TT> makes <TT><B>$n1</B></TT> an alias for <TT><B>$n2</B></TT>.
  621. </TD>
  622. </TR>
  623. </TABLE>
  624. <P>
  625. You can always use a <TT><B>{</B></TT><FONT SIZE="-1">BLOCK</FONT><TT><B>}</B></TT>
  626. returning the right type of reference instead of the variable identifier, e.g.,
  627. <TT><B>${</B></TT>...<TT><B>}</B></TT>,
  628. <TT><B>&amp;{</B></TT>...<TT><B>}</B></TT>.
  629. <TT><B>$$p</B></TT> is just a shorthand for <TT><B>${$p}</B></TT>.
  630. </P>
  631. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  632. <A NAME="operators"></A>
  633. <H2>Operators</H2>
  634. <TABLE CELLSPACING=0 CELLPADDING=0>
  635. <TR>
  636. <TD VALIGN=top><TT><B>**</B></TT></TD>
  637. <TD></TD>
  638. <TD>Exponentiation</TD>
  639. </TR>
  640. <TR>
  641. <TD NOWRAP VALIGN=top><TT><B>+ -&nbsp;</B></TT></TD>
  642. <TD NOWRAP VALIGN=top><TT><B>* /&nbsp;</B></TT></TD>
  643. <TD>Addition, subtraction, multiplication, division</TD>
  644. </TR>
  645. <TR>
  646. <TD VALIGN=top><TT><B>%</B></TT></TD>
  647. <TD></TD>
  648. <TD>Modulo division</TD>
  649. </TR>
  650. <TR>
  651. <TD VALIGN=top><TT><B>&amp; |</B></TT></TD>
  652. <TD VALIGN=top><TT><B>^</B></TT></TD>
  653. <TD>Bitwise AND, bitwise OR, bitwise exclusive OR</TD>
  654. </TR>
  655. <TR>
  656. <TD VALIGN=top><TT><B>&gt;&gt;</B></TT></TD>
  657. <TD VALIGN=top><TT><B>&lt;&lt;</B></TT></TD>
  658. <TD>Bitwise shift right, bitwise shift left</TD>
  659. </TR>
  660. <TR>
  661. <TD VALIGN=top><TT><B>||</B></TT></TD>
  662. <TD VALIGN=top><TT><B>&amp;&amp;</B></TT></TD>
  663. <TD>Logical OR, logical AND</TD>
  664. </TR>
  665. <TR>
  666. <TD VALIGN=top><TT><B>.</B></TT></TD>
  667. <TD></TD>
  668. <TD>Concatenation of two strings</TD>
  669. </TR>
  670. <TR>
  671. <TD VALIGN=top><TT><B>x</B></TT></TD>
  672. <TD VALIGN=top></TD>
  673. <TD VALIGN=top>Returns a string or array consisting of the left operand (an array or a string)
  674. repeated the number of times specified by the right operand</TD>
  675. </TR>
  676. <TR>
  677. <TD COLSPAN=3>
  678. All of the above operators also have an assignment operator,
  679. e.g., <TT><B>.=</B></TT></TD>
  680. </TR>
  681. <TR>
  682. <TD VALIGN=top><TT><B>-&gt;</B></TT></TD>
  683. <TD></TD>
  684. <TD>Dereference operator</TD>
  685. </TR>
  686. <TR>
  687. <TD VALIGN=top><TT><B>\</B></TT></TD>
  688. <TD></TD>
  689. <TD>Reference (unary)</TD>
  690. </TR>
  691. <TR>
  692. <TD VALIGN=top><TT><B>!</B></TT></TD>
  693. <TD VALIGN=top><TT><B>~</B></TT></TD>
  694. <TD>Negation (unary), bitwise complement (unary)</TD>
  695. </TR>
  696. <TR>
  697. <TD VALIGN=top><TT><B>++</B></TT></TD>
  698. <TD VALIGN=top><TT><B>--</B></TT></TD>
  699. <TD>Auto-increment (magical on strings), auto-decrement</TD>
  700. </TR>
  701. <TR>
  702. <TD VALIGN=top><TT><B>==</B></TT></TD>
  703. <TD VALIGN=top><TT><B>!=</B></TT></TD>
  704. <TD>Numeric equality, inequality</TD>
  705. </TR>
  706. <TR>
  707. <TD VALIGN=top><TT><B>eq</B></TT></TD>
  708. <TD VALIGN=top><TT><B>ne</B></TT></TD>
  709. <TD>String equality, inequality</TD>
  710. </TR>
  711. <TR>
  712. <TD VALIGN=top><TT><B>&lt;</B></TT></TD>
  713. <TD VALIGN=top><TT><B>&gt;</B></TT></TD>
  714. <TD>Numeric less than, greater than</TD>
  715. </TR>
  716. <TR>
  717. <TD VALIGN=top><TT><B>lt</B></TT></TD>
  718. <TD VALIGN=top><TT><B>gt</B></TT></TD>
  719. <TD>String less than, greater than</TD>
  720. </TR>
  721. <TR>
  722. <TD VALIGN=top><TT><B>&lt;=</B></TT></TD>
  723. <TD VALIGN=top><TT><B>&gt;=</B></TT></TD>
  724. <TD>Numeric less (greater) than or equal to</TD>
  725. </TR>
  726. <TR>
  727. <TD VALIGN=top><TT><B>le</B></TT></TD>
  728. <TD VALIGN=top><TT><B>ge</B></TT></TD>
  729. <TD>String less (greater) than or equal to</TD>
  730. </TR>
  731. <TR>
  732. <TD VALIGN=top><TT><B>&lt;=&gt;</B></TT></TD>
  733. <TD VALIGN=top><TT><B>cmp</B></TT></TD>
  734. <TD>Numeric (string) compare. Returns -1, 0, 1.</TD>
  735. </TR>
  736. <TR>
  737. <TD VALIGN=top><TT><B>=~</B></TT></TD>
  738. <TD VALIGN=top><TT><B>!~</B></TT></TD>
  739. <TD>Search pattern, substitution, or translation (negated)</TD>
  740. </TR>
  741. <TR>
  742. <TD VALIGN=top><TT><B>..</B></TT></TD>
  743. <TD></TD>
  744. <TD>Range (scalar context) or enumeration (array context)</TD>
  745. </TR>
  746. <TR>
  747. <TD VALIGN=top><TT><B>?:</B></TT></TD>
  748. <TD></TD>
  749. <TD>Alternation (if-then-else) operator</TD>
  750. </TR>
  751. <TR>
  752. <TD VALIGN=top><TT><B>,</B></TT></TD>
  753. <TD></TD>
  754. <TD>Comma operator, also list element separator.
  755. You can also use <TT><B>=&gt;</B></TT>.
  756. </TD>
  757. </TR>
  758. <TR>
  759. <TD VALIGN=top><TT><B>not</B></TT></TD>
  760. <TD></TD>
  761. <TD>Low-precedence negation
  762. </TD>
  763. </TR>
  764. <TR>
  765. <TD VALIGN=top><TT><B>and</B></TT></TD>
  766. <TD></TD>
  767. <TD>Low-precedence AND
  768. </TD>
  769. </TR>
  770. <TR>
  771. <TD VALIGN=top><TT><B>or</B></TT></TD>
  772. <TD VALIGN=top><TT><B>xor</B></TT></TD>
  773. <TD>Low-precedence OR, exclusive OR
  774. </TD>
  775. </TR>
  776. </TABLE>
  777. <P>All Perl functions can be used as list operators, in which case
  778. they have very high or very low precedence, depending on
  779. whether you look at the left or the right side of the operator.
  780. Only the operators <B>not</B>, <B>and</B>, <B>or</B> and <B>xor</B> have lower precedence.</P>
  781. <P>A "list" is a list of expressions, variables, or lists. An array
  782. variable or an array slice may always be used instead of a list.</P>
  783. <P>Parentheses can be added around the parameter lists
  784. to avoid precedence problems.</P>
  785. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  786. <!-- ----------------------------------------------------------------------------- -->
  787. <A NAME="statements"></A>
  788. <H2>Statements</H2>
  789. <P>Every statement is an expression, optionally followed by a modifier,
  790. and terminated by a semicolon. The semicolon may be omitted if the
  791. statement is the final one in a <FONT SIZE="-1">BLOCK</FONT>.</P>
  792. <P>Execution of expressions can depend on other expressions using one of the modifiers
  793. <B>if</B>, <B>unless</B>, <B>while</B> or <B>until</B>, for example:</P>
  794. <UL>
  795. <FONT SIZE="-1">EXPR1</FONT> <B>if</B> <FONT SIZE="-1">EXPR2</FONT> <TT><B>;</B></TT>
  796. <BR>
  797. <FONT SIZE="-1">EXPR1</FONT> <B>until</B> <FONT SIZE="-1">EXPR2</FONT> <TT><B>;</B></TT>
  798. </UL>
  799. <P>The logical operators <TT><B>||</B></TT>,
  800. <TT><B>&amp;&amp;</B></TT> or
  801. <TT><B>?:</B></TT> also allow conditional execution:</P>
  802. <UL>
  803. <FONT SIZE="-1">EXPR1</FONT> <TT><B>||</B></TT> <FONT SIZE="-1">EXPR2</FONT> <TT><B>;</B></TT>
  804. <BR>
  805. <FONT SIZE="-1">EXPR1</FONT> <TT><B>?</B></TT> <FONT SIZE="-1">EXPR2</FONT> <TT><B>:</B></TT> <FONT SIZE="-1">EXPR3</FONT> <TT><B>;</B></TT>
  806. </UL>
  807. <P>Statements can be combined to form a <FONT SIZE="-1">BLOCK</FONT>
  808. when enclosed in <TT><B>{}</B></TT>. Blocks may be used to control flow:</P>
  809. <UL>
  810. <B>if</B> <TT><B>(</B></TT><FONT SIZE="-1">EXPR</FONT><TT><B>)</B></TT> <FONT SIZE="-1">BLOCK</FONT>
  811. [ [ <B>elsif</B> <TT><B>(</B></TT><FONT SIZE="-1">EXPR</FONT><TT><B>)</B></TT> <FONT SIZE="-1">BLOCK</FONT> ... ]
  812. <B>else</B> <FONT SIZE="-1">BLOCK</FONT> ]
  813. <BR>
  814. <B>unless</B> <TT><B>(</B></TT><FONT SIZE="-1">EXPR</FONT><TT><B>)</B></TT> <FONT SIZE="-1">BLOCK</FONT>
  815. [ <B>else</B> <FONT SIZE="-1">BLOCK</FONT> ]
  816. <BR>
  817. [ <FONT SIZE="-1">LABEL</FONT><TT><B>:</B></TT> ]
  818. <B>while</B> (<FONT SIZE="-1">EXPR</FONT>) <FONT SIZE="-1">BLOCK</FONT> [ <B>continue</B> <FONT SIZE="-1">BLOCK</FONT> ]
  819. <BR>
  820. [ <FONT SIZE="-1">LABEL</FONT><TT><B>:</B></TT> ]
  821. <B>until</B> (<FONT SIZE="-1">EXPR</FONT>) <FONT SIZE="-1">BLOCK</FONT> [ <B>continue</B> <FONT SIZE="-1">BLOCK</FONT> ]
  822. <BR>
  823. [ <FONT SIZE="-1">LABEL</FONT><TT><B>:</B></TT> ]
  824. <B>for</B> (<FONT SIZE="-1">EXPR</FONT><TT><B>;</B></TT> <FONT SIZE="-1">EXPR</FONT><TT><B>;</B></TT> <FONT SIZE="-1">EXPR</FONT>) <FONT SIZE="-1">BLOCK</FONT>
  825. <BR>
  826. [ <FONT SIZE="-1">LABEL</FONT><TT><B>:</B></TT> ]
  827. <B>foreach</B> <FONT SIZE="-1">VAR&#134;</FONT> (<FONT SIZE="-1">LIST</FONT>) <FONT SIZE="-1">BLOCK</FONT>
  828. <BR>
  829. [ <FONT SIZE="-1">LABEL</FONT><TT><B>:</B></TT> ]
  830. <FONT SIZE="-1">BLOCK</FONT> [ <B>continue</B> <FONT SIZE="-1">BLOCK</FONT> ]
  831. </UL>
  832. <P>Program flow can be controlled with:</P>
  833. <UL>
  834. <TABLE CELLPADDING=0 CELLSPACING=0>
  835. <TR><TD NOWRAP VALIGN=top><B>goto</B> <FONT SIZE="-1">LABEL</FONT></TD>
  836. <TD>Continue execution at the specified label.</TD></TR>
  837. <TR><TD NOWRAP VALIGN=top><B>last</B> [ <FONT SIZE="-1">LABEL</FONT> ]</TD>
  838. <TD>Immediately exits the loop in question. Skips continue block.</TD></TR>
  839. <TR><TD NOWRAP VALIGN=top><B>next</B> [ <FONT SIZE="-1">LABEL</FONT> ]</TD>
  840. <TD>Starts the next iteration of the loop.</TD></TR>
  841. <TR><TD NOWRAP VALIGN=top><B>redo</B> [ <FONT SIZE="-1">LABEL</FONT> ]&nbsp;&nbsp;</TD>
  842. <TD>Restarts the loop block without evaluating the conditional again.</TD></TR>
  843. </TABLE>
  844. </UL>
  845. <P>Special forms are:</P>
  846. <UL>
  847. <B>do</B> <FONT SIZE="-1">BLOCK</FONT> <B>while</B> <FONT SIZE="-1">EXPR</FONT> <TT><B>;</B></TT>
  848. <BR>
  849. <B>do</B> <FONT SIZE="-1">BLOCK</FONT> <B>until</B> <FONT SIZE="-1">EXPR</FONT> <TT><B>;</B></TT>
  850. </UL>
  851. <P>which are guaranteed to perform <FONT SIZE="-1">BLOCK</FONT>
  852. once before testing <FONT SIZE="-1">EXPR</FONT>, and</P>
  853. <UL>
  854. <B>do</B> <FONT SIZE="-1">BLOCK</FONT>
  855. </UL>
  856. <P>which effectively turns <FONT SIZE="-1">BLOCK</FONT> into an expression.</P>
  857. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  858. <!-- ----------------------------------------------------------------------------- -->
  859. <A NAME="subroutines"></A>
  860. <H2>Subroutines, Packages and Modules</H2>
  861. <DL>
  862. <DT><TT><B>&amp;</B></TT><FONT SIZE="-1">SUBROUTINE LIST</FONT>
  863. <DD>Executes a <FONT SIZE="-1">SUBROUTINE</FONT> declared by a <B>sub</B> declaration, and
  864. returns the value of the last expression evaluated in <FONT SIZE="-1">SUBROUTINE</FONT>.
  865. <FONT SIZE="-1">SUBROUTINE</FONT> can be an expression yielding a reference to a code object.
  866. The <TT><B>&amp;</B></TT> may be omitted if the subroutine has been declared
  867. before being used.
  868. <DT><B>bless</B> <FONT SIZE="-1">REF</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">PACKAGE</FONT> ]
  869. <DD>Turns the object <FONT SIZE="-1">REF</FONT>
  870. into an object in <FONT SIZE="-1">PACKAGE</FONT>.
  871. Returns the reference.
  872. <DT><B>caller</B> [ <FONT SIZE="-1">EXPR</FONT> ]
  873. <DD>Returns an array (<TT><B>$</B></TT>package,<TT><B>$</B></TT>file,<TT><B>$</B></TT>line,...)
  874. for a specific subroutine call.
  875. <TT><B>caller</B></TT> returns this info for the current subroutine,
  876. <TT><B>caller(1)</B></TT> for the caller of this subroutine, etc.
  877. Returns <B>false</B> if no caller.
  878. <DT><B>do</B> <FONT SIZE="-1">SUBROUTINE</FONT> <FONT SIZE="-1">LIST</FONT>
  879. <DD>Depreciated form of <TT><B>&amp;</B></TT><FONT SIZE="-1">SUBROUTINE</FONT>.
  880. <DT><B>goto</B> <TT><B>&amp;</B></TT><FONT SIZE="-1">SUBROUTINE</FONT>
  881. <DD>Substitutes a call to <FONT SIZE="-1">SUBROUTINE</FONT> for the current subroutine.
  882. <DT><B>import</B> <FONT SIZE="-1">MODULE</FONT> [ [ <FONT SIZE="-1">VERSION</FONT> ] <FONT SIZE="-1">LIST</FONT> ]
  883. <DD>Imports the named subroutines from <FONT SIZE="-1">MODULE</FONT>.
  884. <DT><B>no</B> <FONT SIZE="-1">MODULE</FONT> [ <FONT SIZE="-1">LIST</FONT> ]
  885. <DD>Cancels imported semantics. See <B>use</B>.
  886. <DT><B>package</B> <FONT SIZE="-1">NAME</FONT>
  887. <DD>Designates the remainder of the current block as a package.
  888. <DT><B>require</B> <FONT SIZE="-1">EXPR&#134;</FONT>
  889. <DD>If <FONT SIZE="-1">EXPR</FONT> is numeric, requires Perl to be at least that
  890. version. Otherwise <FONT SIZE="-1">EXPR</FONT> must be the name of a file
  891. that is included from the Perl library. Does not
  892. include more than once, and yields a fatal error if
  893. the file does not evaluate to a <B>true</B> value.
  894. If <FONT SIZE="-1">EXPR</FONT> is a bare word, assumes extension <TT><B>.pm</B></TT>
  895. for the name of the file.
  896. <DT><B>return</B> <FONT SIZE="-1">EXPR</FONT>
  897. <DD>Returns from a subroutine with the value specified.
  898. <DT><B>sub</B> <FONT SIZE="-1">NAME</FONT> <TT><B>{</B></TT> <FONT SIZE="-1">EXPR</FONT> <TT><B>;</B></TT> ... <TT><B>}</B></TT>
  899. <DD>Designates <FONT SIZE="-1">NAME</FONT> as a subroutine.
  900. Parameters are passed by reference as array <TT><B>@_</B></TT>.
  901. Returns the value of the last expression evaluated.
  902. <DT>[ <B>sub</B> ] <TT><B>BEGIN</B></TT> <TT><B>{</B></TT> <FONT SIZE="-1">EXPR</FONT> <TT><B>;</B></TT> ... <TT><B>}</B></TT>
  903. <DD>Defines a setup <FONT SIZE="-1">BLOCK</FONT> to be called before execution.
  904. <DT>[ <B>sub</B> ] <TT><B>END</B></TT> <TT><B>{</B></TT> <FONT SIZE="-1">EXPR</FONT> <TT><B>;</B></TT> ... <TT><B>}</B></TT>
  905. <DD>Defines a cleanup <FONT SIZE="-1">BLOCK</FONT> to be called upon termination.
  906. <DT><B>tie</B> <FONT SIZE="-1">VAR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">PACKAGE</FONT><TT><B>,</B></TT> [ <FONT SIZE="-1">LIST</FONT> ]
  907. <DD>Ties a variable to a package that will handle it.
  908. Can be used to bind a dbm or ndbm file to a hash.
  909. <DT><B>untie</B> <FONT SIZE="-1">VAR</FONT>
  910. <DD>Breaks the binding between the variable and the package.
  911. <DT><B>use</B> <FONT SIZE="-1">MODULE</FONT> [ [ <FONT SIZE="-1">VERSION</FONT> ] <FONT SIZE="-1">LIST</FONT> ]
  912. <DD>Imports semantics from the named module into the current package.
  913. </DL>
  914. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  915. <!-- ----------------------------------------------------------------------------- -->
  916. <A NAME="object"></A>
  917. <H2>Object-Oriented Programming</H2>
  918. <P>Perl rules of object oriented programming:</P>
  919. <UL>
  920. <LI>An object is simply a reference that happens to know which class it
  921. belongs to. Objects are blessed, references are not.
  922. <LI>A class is simply a package that happens to provide methods to deal
  923. with object references. If a package fails to provide a method, the base classes as
  924. listed in <TT><B>@ISA</B></TT> are searched.
  925. <LI>A method is simply a subroutine that expects an object reference (or a
  926. package name, for static methods) as the first argument.
  927. </UL>
  928. <P>Methods can be applied with:</P>
  929. <UL>
  930. <FONT SIZE="-1">METHOD</FONT> <FONT SIZE="-1">OBJREF</FONT> <FONT SIZE="-1">PARAMETERS</FONT>
  931. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or<BR>
  932. <FONT SIZE="-1">OBJREF</FONT><TT><B>-&gt;</B></TT><FONT SIZE="-1">METHOD</FONT> <FONT SIZE="-1">PARAMETERS</FONT>
  933. </UL>
  934. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  935. <!-- ----------------------------------------------------------------------------- -->
  936. <A NAME="arithmetic"></A>
  937. <H2>Arithmetic Functions</H2>
  938. <TABLE CELLSPACING=0 CELLPADDING=0>
  939. <TR><TD VALIGN=top><B>abs</B> <FONT SIZE="-1">EXPR&#134;</FONT></TD>
  940. <TD VALIGN=top>Returns the absolute value of its operand.</TD></TR>
  941. <TR><TD VALIGN=top><B>atan2</B> <FONT SIZE="-1">Y</FONT><TT><B>,</B></TT><FONT SIZE="-1">X</FONT></TD>
  942. <TD VALIGN=top>Returns the arctangent of <FONT SIZE="-1">Y/X</FONT> in the range -pi to pi.</TD></TR>
  943. <TR><TD VALIGN=top><B>cos</B> <FONT SIZE="-1">EXPR&#134;</FONT></TD>
  944. <TD VALIGN=top>Returns the cosine of <FONT SIZE="-1">EXPR</FONT> (expressed in radians).</TD></TR>
  945. <TR><TD VALIGN=top><B>exp</B> <FONT SIZE="-1">EXPR&#134;</FONT></TD>
  946. <TD VALIGN=top>Returns <TT><B>e</B></TT> to the power of <FONT SIZE="-1">EXPR</FONT>.</TD></TR>
  947. <TR><TD VALIGN=top><B>int</B> <FONT SIZE="-1">EXPR&#134;</FONT></TD>
  948. <TD VALIGN=top>Returns the integer portion of <FONT SIZE="-1">EXPR</FONT>.</TD></TR>
  949. <TR><TD VALIGN=top><B>log</B> <FONT SIZE="-1">EXPR&#134;</FONT></TD>
  950. <TD VALIGN=top>Returns natural logarithm (base <TT><B>e</B></TT>) of <FONT SIZE="-1">EXPR</FONT>.</TD></TR>
  951. <TR><TD VALIGN=top><B>rand</B> [ <FONT SIZE="-1">EXPR</FONT> ]</TD>
  952. <TD VALIGN=top>Returns a random fractional number between 0 and the value of <FONT SIZE="-1">EXPR</FONT>.
  953. If <FONT SIZE="-1">EXPR</FONT> is omitted, returns a value between 0 and 1.</TD></TR>
  954. <TR><TD VALIGN=top><B>sin</B> <FONT SIZE="-1">EXPR&#134;</FONT></TD>
  955. <TD VALIGN=top>Returns the sine of <FONT SIZE="-1">EXPR</FONT> (expressed in radians).</TD></TR>
  956. <TR><TD VALIGN=top><B>sqrt</B> <FONT SIZE="-1">EXPR&#134;</FONT></TD>
  957. <TD VALIGN=top>Returns the square root of <FONT SIZE="-1">EXPR</FONT>.</TD></TR>
  958. <TR><TD VALIGN=top NOWRAP><B>srand</B> [ <FONT SIZE="-1">EXPR</FONT> ] &nbsp;&nbsp;</TD>
  959. <TD VALIGN=top>Sets the random number seed for the <B>rand</B> operator.</TD></TR>
  960. <TR><TD VALIGN=top><B>time</B></TD>
  961. <TD VALIGN=top>Returns the number of seconds since January 1, 1970. Suitable for
  962. feeding to <B>gmtime</B> and <B>localtime</B>.</TD></TR>
  963. </TABLE>
  964. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  965. <!-- ----------------------------------------------------------------------------- -->
  966. <A NAME="conversion"></A>
  967. <H2>Conversion Functions</H2>
  968. <DL>
  969. <DT><B>chr</B> <FONT SIZE="-1">EXPR&#134;</FONT>
  970. <DD>Returns the character represented by the decimal value <FONT SIZE="-1">EXPR</FONT>.
  971. <DT><B>gmtime</B> <FONT SIZE="-1">EXPR&#134;</FONT>
  972. <DD>Converts a time as returned by the <B>time</B> function to a 9-element array
  973. (0:&nbsp;<TT><B>$</B></TT>sec,
  974. 1:&nbsp;<TT><B>$</B></TT>min,
  975. 2:&nbsp;<TT><B>$</B></TT>hour,
  976. 3:&nbsp;<TT><B>$</B></TT>mday,
  977. 4:&nbsp;<TT><B>$</B></TT>mon,
  978. 5:&nbsp;<TT><B>$</B></TT>year,
  979. 6:&nbsp;<TT><B>$</B></TT>wday,
  980. 7:&nbsp;<TT><B>$</B></TT>yday,
  981. 8:&nbsp;<TT><B>$</B></TT>isdst)
  982. with the time analyzed for the Greenwich time zone. <TT><B>$</B></TT>mon has the range 0..11 and
  983. <TT><B>$</B></TT>wday has the range 0..6.
  984. <DT><B>hex</B> <FONT SIZE="-1">EXPR&#134;</FONT>
  985. <DD>Returns the decimal value of <FONT SIZE="-1">EXPR</FONT> interpreted as a hex string.
  986. <DT><B>localtime</B> <FONT SIZE="-1">EXPR&#134;</FONT>
  987. <DD>Converts a time as returned by the <B>time</B> function to
  988. <I>ctime</I>(3) string.
  989. In array context, returns a 9-element array with the time analyzed for the local time zone.
  990. <DT><B>oct</B> <FONT SIZE="-1">EXPR&#134;</FONT>
  991. <DD>Returns the decimal value of <FONT SIZE="-1">EXPR</FONT> interpreted as an octal string.
  992. If <FONT SIZE="-1">EXPR</FONT> starts off with <TT><B>0x</B></TT>, interprets it as a hex string
  993. instead.
  994. <DT><B>ord</B> <FONT SIZE="-1">EXPR&#134;</FONT>
  995. <DD>Returns the ASCII value of the first character of <FONT SIZE="-1">EXPR</FONT>.
  996. <DT><B>vec</B> <FONT SIZE="-1">EXPR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">OFFSET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">BITS</FONT>
  997. <DD>Treats string <FONT SIZE="-1">EXPR</FONT> as a vector of unsigned integers,
  998. and yields the bit at <FONT SIZE="-1">OFFSET</FONT>.
  999. <FONT SIZE="-1">BITS</FONT> must be between 1 and 32.
  1000. May be assigned to.
  1001. </DL>
  1002. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  1003. <!-- ----------------------------------------------------------------------------- -->
  1004. <A NAME="structure"></A>
  1005. <H2>Structure Conversion</H2>
  1006. <DL>
  1007. <DT><B>pack</B> <FONT SIZE="-1">TEMPLATE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LIST</FONT>
  1008. <DD>Packs the values into a binary structure using <FONT SIZE="-1">TEMPLATE</FONT>.
  1009. <DT><B>unpack</B> <FONT SIZE="-1">TEMPLATE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">EXPR</FONT>
  1010. <DD>Unpacks the structure <FONT SIZE="-1">EXPR</FONT> into an array,
  1011. using <FONT SIZE="-1">TEMPLATE</FONT>.
  1012. </DL>
  1013. <P><FONT SIZE="-1">TEMPLATE</FONT> is a sequence of characters as follows:</P>
  1014. <UL>
  1015. <TABLE CELLSPACING=0 CELLPADDING=0>
  1016. <TR><TD><TT><B>a</B></TT> / <TT><B>A&nbsp;</B></TT></TD>
  1017. <TD>ASCII string, null- / space-padded</TD></TR>
  1018. <TR><TD><TT><B>b</B></TT> / <TT><B>B</B></TT></TD>
  1019. <TD>Bit string in ascending / descending order</TD></TR>
  1020. <TR><TD><TT><B>c</B></TT> / <TT><B>C</B></TT></TD>
  1021. <TD>Native / unsigned char value</TD></TR>
  1022. <TR><TD><TT><B>f</B></TT> / <TT><B>d</B></TT></TD>
  1023. <TD>Single / double float in native format</TD></TR>
  1024. <TR><TD><TT><B>h</B></TT> / <TT><B>H</B></TT></TD>
  1025. <TD>Hex string, low / high nybble first</TD></TR>
  1026. <TR><TD><TT><B>i</B></TT> / <TT><B>I</B></TT></TD>
  1027. <TD>Signed / unsigned integer value</TD></TR>
  1028. <TR><TD><TT><B>l</B></TT> / <TT><B>L</B></TT></TD>
  1029. <TD>Signed / unsigned long value</TD></TR>
  1030. <TR><TD><TT><B>n</B></TT> / <TT><B>N</B></TT></TD>
  1031. <TD>Short / long in network (big endian) byte order</TD></TR>
  1032. <TR><TD><TT><B>s</B></TT> / <TT><B>S</B></TT></TD>
  1033. <TD>Signed / unsigned short value</TD></TR>
  1034. <TR><TD><TT><B>u</B></TT> / <TT><B>P</B></TT></TD>
  1035. <TD>Uuencoded string / pointer to a string</TD></TR>
  1036. <TR><TD><TT><B>v</B></TT> / <TT><B>V</B></TT></TD>
  1037. <TD>Short / long in VAX (little endian) byte order</TD></TR>
  1038. <TR><TD><TT><B>x</B></TT> / <TT><B>@</B></TT></TD>
  1039. <TD>Null byte / null fill until position</TD></TR>
  1040. <TR><TD><TT><B>X</B></TT></TD>
  1041. <TD>Backup a byte</TD></TR>
  1042. </TABLE>
  1043. </UL>
  1044. <P>Each character may be followed by a decimal number that
  1045. will be used as a repeat count; an asterisk (<TT><B>*</B></TT>) specifies all
  1046. remaining arguments. If the format is preceded with <TT><B>%</B></TT><FONT SIZE="-1">N</FONT>,
  1047. <B>unpack</B> returns an <FONT SIZE="-1">N</FONT>-bit checksum instead. Spaces may be
  1048. included in the template for readability purposes.</P>
  1049. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  1050. <!-- ----------------------------------------------------------------------------- -->
  1051. <A NAME="string"></A>
  1052. <H2>String Functions</H2>
  1053. <DL>
  1054. <DT><B>chomp</B> <FONT SIZE="-1">LIST&#134;</FONT>
  1055. <DD>Removes line endings from all elements of the list;
  1056. returns the (total) number of characters removed.
  1057. <DT><B>chop</B> <FONT SIZE="-1">LIST&#134;</FONT>
  1058. <DD>Chops off the last character on all elements of the
  1059. list; returns the last chopped character.
  1060. <DT><B>crypt</B> <FONT SIZE="-1">PLAINTEXT</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SALT</FONT>
  1061. <DD>Encrypts a string.
  1062. <DT><B>eval</B> <FONT SIZE="-1">EXPR&#134;</FONT>
  1063. <DD><FONT SIZE="-1">EXPR</FONT> is parsed and executed as if it were a Perl program.
  1064. The value returned is the value of the last expression evaluated.
  1065. If there is a syntax error or runtime error,
  1066. an undefined string is returned by <B>eval</B>, and
  1067. <TT><B>$@</B></TT> is set to the error message.
  1068. See also <B>eval</B> in section <A HREF="#miscellaneous">Miscellaneous</A>.
  1069. <DT><B>index</B> <FONT SIZE="-1">STR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SUBSTR</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">OFFSET</FONT> ]
  1070. <DD>Returns the position of <FONT SIZE="-1">SUBSTR</FONT>
  1071. in <FONT SIZE="-1">STR</FONT> at or after <FONT SIZE="-1">OFFSET</FONT>.
  1072. If the substring is not found, returns <TT><B>-1</B></TT>
  1073. (but see <TT><B>$[</B></TT> in section <A HREF="#specialvariables">Special Variables</A>).
  1074. <DT><B>length</B> <FONT SIZE="-1">EXPR&#134;</FONT>
  1075. <DD>Returns the length in characters of the value of <FONT SIZE="-1">EXPR</FONT>.
  1076. <DT><B>lc</B> <FONT SIZE="-1">EXPR</FONT>
  1077. <DD>Returns a lowercase version of <FONT SIZE="-1">EXPR</FONT>.
  1078. <DT><B>lcfirst</B> <FONT SIZE="-1">EXPR</FONT>
  1079. <DD>Returns <FONT SIZE="-1">EXPR</FONT> with the first character lowercase.
  1080. <DT><B>quotemeta</B> <FONT SIZE="-1">EXPR</FONT>
  1081. <DD>Returns <FONT SIZE="-1">EXPR</FONT> with all regular expression metacharacters quoted.
  1082. <DT><B>rindex</B> <FONT SIZE="-1">STR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SUBSTR</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">OFFSET</FONT> ]
  1083. <DD>Returns the position of the last <FONT SIZE="-1">SUBSTR</FONT>
  1084. in <FONT SIZE="-1">STR</FONT> at or before <FONT SIZE="-1">OFFSET</FONT>.
  1085. <DT><B>substr</B> <FONT SIZE="-1">EXPR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">OFFSET</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">LEN</FONT> ]
  1086. <DD>Extracts a substring of length <FONT SIZE="-1">LEN</FONT> out of <FONT SIZE="-1">EXPR</FONT>
  1087. and returns it. If <FONT SIZE="-1">OFFSET</FONT> is negative, counts from the end of
  1088. the string. May be assigned to.
  1089. <DT><B>uc</B> <FONT SIZE="-1">EXPR</FONT>
  1090. <DD>Returns an uppercased version of <FONT SIZE="-1">EXPR</FONT>.
  1091. <DT><B>ucfirst</B> <FONT SIZE="-1">EXPR</FONT>
  1092. <DD>Returns <FONT SIZE="-1">EXPR</FONT> with the first character uppercased.
  1093. </DL>
  1094. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  1095. <!-- ----------------------------------------------------------------------------- -->
  1096. <A NAME="array"></A>
  1097. <H2>Array and List Functions</H2>
  1098. <DL>
  1099. <DT><B>delete</B> <TT><B>$</B></TT><FONT SIZE="-1">HASH</FONT><TT><B>{</B></TT><FONT SIZE="-1">KEY</FONT><TT><B>}</B></TT>
  1100. <DD>Deletes the specified value from the specified hash.
  1101. Returns the deleted value unless <FONT SIZE="-1">HASH</FONT> is <B>tie</B>d
  1102. to a package that does not support this.
  1103. <DT><B>each</B> <TT><B>%</B></TT><FONT SIZE="-1">HASH</FONT>
  1104. <DD>Returns a 2-element array consisting of the key and value for the next value
  1105. of the hash. Entries are returned in an apparently random order.
  1106. After all values of the hash have been returned, a null array is
  1107. returned. The next call to <B>each</B> after that will start iterating again.
  1108. <DT><B>exists</B> <FONT SIZE="-1">EXPR&#134;</FONT>
  1109. <DD>Checks if the specified hash key exists in its hash array.
  1110. <DT><B>grep</B> <FONT SIZE="-1">EXPR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LIST</FONT>
  1111. <BR><B>grep</B> <FONT SIZE="-1">BLOCK</FONT> <FONT SIZE="-1">LIST</FONT>
  1112. <DD>Evaluates <FONT SIZE="-1">EXPR</FONT> or <FONT SIZE="-1">BLOCK</FONT> for each element of the <FONT SIZE="-1">LIST</FONT>,
  1113. locally setting <TT><B>$_</B></TT> to refer to the element.
  1114. Modifying <TT><B>$_</B></TT> will modify the
  1115. corresponding element from <FONT SIZE="-1">LIST</FONT>.
  1116. Returns the array of elements from
  1117. <FONT SIZE="-1">LIST</FONT> for which <FONT SIZE="-1">EXPR</FONT> returned <B>true</B>.
  1118. <DT><B>join</B> <FONT SIZE="-1">EXPR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LIST</FONT>
  1119. <DD>Joins the separate strings of <FONT SIZE="-1">LIST</FONT> into a single string with fields
  1120. separated by the value of <FONT SIZE="-1">EXPR</FONT>, and returns the string.
  1121. <DT><B>keys</B> <TT><B>%</B></TT><FONT SIZE="-1">HASH</FONT>
  1122. <DD>Returns an array with of all the keys of the named hash.
  1123. <DT><B>map</B> <FONT SIZE="-1">EXPR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LIST</FONT>
  1124. <BR><B>map</B> <FONT SIZE="-1">BLOCK</FONT> <FONT SIZE="-1">LIST</FONT>
  1125. <DD>Evaluates <FONT SIZE="-1">EXPR</FONT> or <FONT SIZE="-1">BLOCK</FONT> for each element of the <FONT SIZE="-1">LIST</FONT>,
  1126. locally setting <TT><B>$_</B></TT> to refer to the element.
  1127. Modifying <TT><B>$_</B></TT> will modify the
  1128. corresponding element from <FONT SIZE="-1">LIST</FONT>.
  1129. Returns the list of results.
  1130. <DT><B>pop</B> <TT><B>@</B></TT><FONT SIZE="-1">ARRAY</FONT>
  1131. <DD>Pops off and returns the last value of the array.
  1132. <DT><B>push</B> <TT><B>@</B></TT><FONT SIZE="-1">ARRAY</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LIST</FONT>
  1133. <DD>Pushes the values of <FONT SIZE="-1">LIST</FONT> onto the end of the array.
  1134. <DT><B>reverse</B> <FONT SIZE="-1">LIST</FONT>
  1135. <DD>In array context, returns the <FONT SIZE="-1">LIST</FONT> in reverse order.
  1136. In scalar context: returns the first element of <FONT SIZE="-1">LIST</FONT>
  1137. with bytes reversed.
  1138. <DT><B>scalar</B> <TT><B>@</B></TT><FONT SIZE="-1">ARRAY</FONT>
  1139. <DD>Returns the number of elements in the array.
  1140. <DT><B>scalar</B> <TT><B>%</B></TT><FONT SIZE="-1">HASH</FONT>
  1141. <DD>Returns a <B>true</B> value if the hash has elements defined.
  1142. <DT><B>shift</B> [ <TT><B>@</B></TT><FONT SIZE="-1">ARRAY</FONT> ]
  1143. <DD>Shifts the first value of the array off and returns it, shortening the array
  1144. by 1 and moving everything down. If <TT><B>@</B></TT><FONT SIZE="-1">ARRAY</FONT> is omitted,
  1145. shifts <TT><B>@ARGV</B></TT> in main and <TT><B>@_</B></TT> in subroutines.
  1146. <DT><B>sort</B> [ <FONT SIZE="-1">SUBROUTINE</FONT> ] <FONT SIZE="-1">LIST</FONT>
  1147. <DD>Sorts the <FONT SIZE="-1">LIST</FONT> and returns the sorted array value.
  1148. <FONT SIZE="-1">SUBROUTINE</FONT>, if specified, must return less than zero,
  1149. zero, or greater than zero, depending on how the
  1150. elements of the array (available to the routine as <TT><B>$a</B></TT> and <TT><B>$b</B></TT>)
  1151. are to be ordered. <FONT SIZE="-1">SUBROUTINE</FONT> may be the name of a user-defined
  1152. routine, or a <FONT SIZE="-1">BLOCK</FONT>.
  1153. <DT><B>splice</B> <TT><B>@</B></TT><FONT SIZE="-1">ARRAY</FONT><TT><B>,</B></TT> <FONT SIZE="-1">OFFSET</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">LENGTH</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">LIST</FONT> ] ]
  1154. <DD>Removes the elements of <TT><B>@</B></TT><FONT SIZE="-1">ARRAY</FONT> designated by
  1155. <FONT SIZE="-1">OFFSET</FONT> and <FONT SIZE="-1">LENGTH</FONT>,
  1156. and replaces them with <FONT SIZE="-1">LIST</FONT> (if specified).
  1157. Returns the elements removed.
  1158. <DT><B>split</B> [ <FONT SIZE="-1">PATTERN</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">EXPR&#134;</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">LIMIT</FONT> ] ] ]
  1159. <DD>Splits a string into an array of strings, and returns it.
  1160. If <FONT SIZE="-1">LIMIT</FONT> is specified, splits into at most that number
  1161. of fields. If <FONT SIZE="-1">PATTERN</FONT> is also omitted, splits at the whitespace.
  1162. If not in array context, returns number of fields and splits to <TT><B>@_</B></TT>.
  1163. See also <A HREF="#search">Search and Replace Functions</A>.
  1164. <DT><B>unshift</B> <TT><B>@</B></TT><FONT SIZE="-1">ARRAY</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LIST</FONT>
  1165. <DD>Prepends list to the front of the array, and returns the number of elements in
  1166. the new array.
  1167. <DT><B>values</B> <TT><B>%</B></TT><FONT SIZE="-1">HASH</FONT>
  1168. <DD>Returns a normal array consisting of all the values of the named hash.
  1169. </DL>
  1170. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  1171. <!-- ----------------------------------------------------------------------------- -->
  1172. <A NAME="regular"></A>
  1173. <H2>Regular Expressions</H2>
  1174. <P>Each character matches itself, unless it is one of the special characters
  1175. <TT><B>+ ? . * ^ $ ( ) [ ] { } | \</B></TT>.
  1176. The special meaning of these characters can be escaped using a <TT><B>\</B></TT>.</P>
  1177. <TABLE CELLSPACING=0 CELLPADDING=0>
  1178. <TR><TD VALIGN=top><TT><B>.</B></TT></TD>
  1179. <TD VALIGN=top>matches an arbitrary character, but not a newline
  1180. unless it is a single-line match (see <B>m//s</B>).</TD></TR>
  1181. <TR><TD VALIGN=top><TT><B>(</B></TT>...<TT><B>)</B></TT></TD>
  1182. <TD>groups a series of pattern elements to a single element.</TD></TR>
  1183. <TR><TD VALIGN=top><TT><B>^</B></TT></TD>
  1184. <TD VALIGN=top>matches the beginning of the target. In multiline mode
  1185. (see <B>m//m</B>) also matches after every newline character.</TD></TR>
  1186. <TR><TD VALIGN=top><TT><B>$</B></TT></TD>
  1187. <TD>matches the end of the line.
  1188. In multiline mode also matches before every newline character.</TD></TR>
  1189. <TR><TD VALIGN=top><TT><B>[</B></TT> ... <TT><B>]</B></TT></TD>
  1190. <TD>denotes a class of characters to match.
  1191. <TT><B>[^</B></TT> ... <TT><B>]</B></TT> negates the class.</TD></TR>
  1192. <TR><TD VALIGN=top><TT><B>(</B></TT> ... <TT><B>|</B></TT> ... <TT><B>|</B></TT> ... <TT><B>)</B></TT></TD>
  1193. <TD>matches one of the alternatives.</TD></TR>
  1194. <TR><TD VALIGN=top><TT><B>(?#</B></TT> <FONT SIZE="-1">TEXT</FONT> <TT><B>)</B></TT></TD>
  1195. <TD>Comment.</TD></TR>
  1196. <TR><TD VALIGN=top><TT><B>(?:</B></TT> <FONT SIZE="-1">REGEXP</FONT> <TT><B>)</B></TT></TD>
  1197. <TD>Like <TT><B>(</B></TT><FONT SIZE="-1">REGEXP</FONT><TT><B>)</B></TT> but does not make back-references.</TD></TR>
  1198. <TR><TD VALIGN=top><TT><B>(?=</B></TT> <FONT SIZE="-1">REGEXP</FONT> <TT><B>)</B></TT></TD>
  1199. <TD>Zero width positive look-ahead assertion.</TD></TR>
  1200. <TR><TD VALIGN=top><TT><B>(?!</B></TT> <FONT SIZE="-1">REGEXP</FONT> <TT><B>)</B></TT></TD>
  1201. <TD>Zero width negative look-ahead assertion.</TD></TR>
  1202. <TR><TD VALIGN=top><TT><B>(?</B></TT> <FONT SIZE="-1">MODIFIER</FONT> <TT><B>)</B></TT></TD>
  1203. <TD>Embedded pattern-match modifier. <FONT SIZE="-1">MODIFIER</FONT> can be one or more of
  1204. <B>i</B>, <B>m</B>, <B>s</B>, or <B>x</B>.</TD></TR>
  1205. <TR><TD COLSPAN=2><BR>Quantified subpatterns match as many times as possible.
  1206. When followed with a <TT><B>?</B></TT> they match the minimum number of times.
  1207. These are the quantifiers:<BR><BR></TD></TR>
  1208. <TR><TD VALIGN=top><TT><B>+</B></TT></TD>
  1209. <TD>matches the preceding pattern element one or more times.</TD></TR>
  1210. <TR><TD VALIGN=top><TT><B>?</B></TT></TD>
  1211. <TD>matches zero or one times.</TD></TR>
  1212. <TR><TD VALIGN=top><TT><B>*</B></TT></TD>
  1213. <TD>matches zero or more times.</TD></TR>
  1214. <TR><TD VALIGN=top><TT><B>{</B></TT><FONT SIZE="-1">N</FONT><TT><B>,</B></TT><FONT SIZE="-1">M</FONT><TT><B>}</B></TT></TD>
  1215. <TD>denotes the minimum <FONT SIZE="-1">N</FONT> and maximum <FONT SIZE="-1">M</FONT> match count.
  1216. <TT><B>{</B></TT><FONT SIZE="-1">N</FONT><TT><B>}</B></TT> means exactly <FONT SIZE="-1">N</FONT> times;
  1217. <TT><B>{</B></TT><FONT SIZE="-1">N</FONT><TT><B>,</B></TT><TT><B>}</B></TT> means at least <FONT SIZE="-1">N</FONT> times.</TD></TR>
  1218. <TR><TD COLSPAN=2><BR>A <TT><B>\</B></TT> escapes any special meaning
  1219. of the following character if non-alphanumeric, but it turns most alphanumeric characters
  1220. into something special:<BR><BR></TD></TR>
  1221. <TR><TD VALIGN=top><TT><B>\w</B></TT></TD>
  1222. <TD>matches alphanumeric, including <TT><B>_</B></TT>,
  1223. <TT><B>\W</B></TT> matches non-alphanumeric.</TD></TR>
  1224. <TR><TD VALIGN=top><TT><B>\s</B></TT></TD>
  1225. <TD>matches whitespace, <TT><B>\S</B></TT> matches non-whitespace.</TD></TR>
  1226. <TR><TD VALIGN=top><TT><B>\d</B></TT></TD>
  1227. <TD>matches numeric, <TT><B>\D</B></TT> matches non-numeric.</TD></TR>
  1228. <TR><TD VALIGN=top><TT><B>\A</B></TT></TD>
  1229. <TD>matches the beginning of the string, <TT><B>\Z</B></TT> matches the end.</TD></TR>
  1230. <TR><TD VALIGN=top><TT><B>\b</B></TT></TD>
  1231. <TD>matches word boundaries, <TT><B>\B</B></TT> matches non-boundaries.</TD></TR>
  1232. <TR><TD VALIGN=top><TT><B>\G</B></TT></TD>
  1233. <TD>matches where the previous <B>m//g</B> search left off.</TD></TR>
  1234. <TR><TD><TT><B>\n</B></TT>, <TT><B>\r</B></TT>, <TT><B>\f</B></TT>, <TT><B>\t</B></TT></TD>
  1235. <TD>etc. have their usual meaning.</TD></TR>
  1236. <TR><TD><TT><B>\w</B></TT>, <TT><B>\s</B></TT> and <TT><B>\d</B></TT></TD>
  1237. <TD>may be used within character classes,
  1238. <TT><B>\b</B></TT> denotes backspace in this context.</TD></TR>
  1239. <TR><TD COLSPAN=2><BR>Back-references:<BR><BR></TD></TR>
  1240. <TR><TD VALIGN=top><TT><B>\1</B></TT> ... <TT><B>\9</B></TT></TD>
  1241. <TD>refer to matched subexpressions, grouped with <TT><B>()</B></TT>,
  1242. inside the match.</TD></TR>
  1243. <TR><TD VALIGN=top><TT><B>\10</B></TT></TD>
  1244. <TD>and up can also be used if the pattern matches that many subexpressions.</TD></TR>
  1245. </TABLE>
  1246. <P>See also <TT><B>$1</B></TT> ... <TT><B>$9</B></TT>,<TT><B> $+</B></TT>,<TT><B> $&amp;</B></TT>,<TT><B> $`</B></TT>, and<TT><B> $' </B></TT>
  1247. in section <A HREF="#specialvariables">Special Variables</A>.</P>
  1248. <P>With modifier <B>x</B>, whitespace can be used in the patterns for
  1249. readability purposes.</P>
  1250. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  1251. <!-- ----------------------------------------------------------------------------- -->
  1252. <A NAME="search"></A>
  1253. <H2>Search and Replace Functions</H2>
  1254. <DL>
  1255. <DT>[ <FONT SIZE="-1">EXPR</FONT> <TT><B>=~</B></TT> ] [ <B>m</B> ] <TT><B>/</B></TT><FONT SIZE="-1">PATTERN</FONT><TT><B>/</B></TT>
  1256. [ <B>g</B> ] [ <B>i</B> ] [ <B>m</B> ] [ <B>o</B> ] [ <B>v</B> ] [ <B>x</B> ]
  1257. <DD>Searches <FONT SIZE="-1">EXPR</FONT> (default: <TT><B>$_</B></TT>) for a pattern. If you
  1258. prepend an <B>m</B> you can use almost any pair of delimiters
  1259. instead of the slashes. If used in array context,
  1260. an array is returned consisting of the subexpressions
  1261. matched by the parentheses in the pattern, i.e., <TT><B>($1,$2,$3,</B></TT>...<TT><B>)</B></TT>.
  1262. <BR>
  1263. Optional modifiers: <B>g</B> matches as many times as
  1264. possible; <B>i</B> searches in a case-insensitive manner; <B>o</B>
  1265. interpolates variables only once. <B>m</B> treats the string
  1266. as multiple lines; <B>s</B> treats the string as a single line; <B>x</B>
  1267. allows for regular expression extensions.
  1268. <BR>
  1269. If <FONT SIZE="-1">PATTERN</FONT> is empty, the most recent pattern from a
  1270. previous match or replacement is used.
  1271. <BR>
  1272. With <B>g</B> the match can be used as an iterator in scalar
  1273. context.
  1274. <DT><TT><B>?</B></TT><FONT SIZE="-1">PATTERN</FONT><TT><B>?</B></TT>
  1275. <DD>This is just like the <TT><B>/</B></TT><FONT SIZE="-1">PATTERN</FONT><TT><B>/</B></TT> search, except that it
  1276. matches only once between calls to the <B>reset</B> operator.
  1277. <DT>[ <TT><B>$</B></TT><FONT SIZE="-1">VAR</FONT> <TT><B>=~</B></TT> ] <B>s</B><TT><B>/</B></TT><FONT SIZE="-1">PATTERN</FONT><TT><B>/</B></TT><FONT SIZE="-1">REPLACEMENT</FONT><TT><B>/</B></TT>
  1278. [ <B>e</B> ] [ <B>g</B> ] [ <B>i</B> ] [ <B>m</B> ] [ <B>o</B> ] [ <B>s</B> ] [ <B>x</B> ]
  1279. <DD>Searches a string for a pattern, and if found, replaces
  1280. that pattern with the replacement text. It returns the
  1281. number of substitutions made, if any; if no substitutions are made, it
  1282. returns <STRONG>false</STRONG>.
  1283. <BR>
  1284. Optional modifiers: <B>g</B> replaces all occurrences of the
  1285. pattern; <B>e</B> evaluates the replacement string as a Perl
  1286. expression; for any other modifiers, see <TT><B>/</B></TT><FONT SIZE="-1">PATTERN</FONT><TT><B>/</B></TT>
  1287. matching. Almost any delimiter may replace the
  1288. slashes; if single quotes are used, no interpretation is
  1289. done on the strings between the delimiters, otherwise
  1290. the strings are interpolated as if inside double quotes.
  1291. <BR>
  1292. If bracketing delimiters are used, <FONT SIZE="-1">PATTERN</FONT> and
  1293. <FONT SIZE="-1">REPLACEMENT</FONT> may have their own delimiters, e.g.,
  1294. <TT><B>s(foo)[bar]</B></TT>. If <FONT SIZE="-1">PATTERN</FONT> is empty, the most recent pattern
  1295. from a previous match or replacement is used.
  1296. <DT>[ <TT><B>$</B></TT><FONT SIZE="-1">VAR</FONT> <TT><B>=~</B></TT> ] <B>tr</B><TT><B>/</B></TT><FONT SIZE="-1">SEARCHLIST</FONT><TT><B>/</B></TT><FONT SIZE="-1">REPLACEMENTLIST</FONT><TT><B>/</B></TT>
  1297. [ <B>c</B> ] [ <B>d</B> ] [ <B>s</B> ]
  1298. <DD>Translates all occurrences of the characters found in
  1299. the search list with the corresponding character in
  1300. the replacement list. It returns the number of characters
  1301. replaced. <B>y</B> may be used instead of <B>tr</B>.
  1302. <BR>
  1303. Optional modifiers: <B>c</B> complements the <FONT SIZE="-1">SEARCHLIST</FONT>;
  1304. <B>d</B> deletes all characters found in <FONT SIZE="-1">SEARCHLIST</FONT> that do
  1305. not have a corresponding character in
  1306. <FONT SIZE="-1">REPLACEMENTLIST</FONT>; <B>s</B> squeezes all
  1307. sequences of characters that are translated into the same target character
  1308. into one occurrence of this character.
  1309. <DT><B>pos</B> <FONT SIZE="-1">SCALAR</FONT>
  1310. <DD>Returns the position where the last <B>m//g</B> search left off
  1311. for <FONT SIZE="-1">SCALAR</FONT>. May be assigned to.
  1312. <DT><B>study</B> [ <TT><B>$</B></TT><FONT SIZE="-1">VAR&#134;</FONT> ]
  1313. <DD>Study the scalar variable <TT><B>$</B></TT><FONT SIZE="-1">VAR</FONT> in anticipation of
  1314. performing many pattern matches on its contents
  1315. before the variable is next modified.
  1316. </DL>
  1317. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  1318. <!-- ----------------------------------------------------------------------------- -->
  1319. <A NAME="filetest"></A>
  1320. <H2>File Test Operators</H2>
  1321. These unary operators takes one argument, either a filename
  1322. or a filehandle, and test the associated file to see if something
  1323. is true about it. If the argument is omitted, they test <TT><B>$_</B></TT>
  1324. (except for <TT><B>-t</B></TT>, which tests <TT><B>STDIN</B></TT>). If the special argument <TT><B>_</B></TT>
  1325. (underscore) is passed, they use the information from the preceding test or <B>stat</B> call.
  1326. <P>
  1327. <TABLE CELLSPACING=0 CELLPADDING=0>
  1328. <TR><TD VALIGN=top NOWRAP><TT><B>-r -w -x&nbsp;</B></TT></TD>
  1329. <TD VALIGN=top>File is readable/writable/executable by effective uid/gid.</TD></TR>
  1330. <TR><TD VALIGN=top NOWRAP><TT><B>-R -W -X</B></TT></TD>
  1331. <TD VALIGN=top>File is readable/writable/executable by real uid/gid.</TD></TR>
  1332. <TR><TD VALIGN=top NOWRAP><TT><B>-o -O</B></TT></TD>
  1333. <TD VALIGN=top>File is owned by effective/real uid.</TD></TR>
  1334. <TR><TD VALIGN=top><TT><B>-e -z</B></TT></TD>
  1335. <TD VALIGN=top>File exists/has zero size.</TD></TR>
  1336. <TR><TD VALIGN=top><TT><B>-s</B></TT></TD>
  1337. <TD VALIGN=top>File exists and has non-zero size. Returns the size.</TD></TR>
  1338. <TR><TD VALIGN=top><TT><B>-f -d</B></TT></TD>
  1339. <TD VALIGN=top>File is a plain file/a directory.</TD></TR>
  1340. <TR><TD VALIGN=top><TT><B>-l -S -p</B></TT></TD>
  1341. <TD VALIGN=top>File is a symbolic link/a socket/a named pipe (FIFO).</TD></TR>
  1342. <TR><TD VALIGN=top><TT><B>-b -c</B></TT></TD>
  1343. <TD VALIGN=top>File is a block/character special file.</TD></TR>
  1344. <TR><TD VALIGN=top><TT><B>-u -g -k</B></TT></TD>
  1345. <TD VALIGN=top>File has setuid/setgid/sticky bit set.</TD></TR>
  1346. <TR><TD VALIGN=top><TT><B>-t</B></TT></TD>
  1347. <TD VALIGN=top>Tests if filehandle (<TT><B>STDIN</B></TT> by default) is opened to a tty.</TD></TR>
  1348. <TR><TD VALIGN=top><TT><B>-T -B</B></TT></TD>
  1349. <TD VALIGN=top>File is a text/non-text (binary) file.
  1350. <TT><B>-T</B></TT> and <TT><B>-B</B></TT> return <B>true</B> on a null file,
  1351. or a file at EOF when testing a filehandle.</TD></TR>
  1352. <TR><TD VALIGN=top><TT><B>-M -A -C</B></TT></TD>
  1353. <TD VALIGN=top>File modification / access / inode-change time.
  1354. Measured in days. Value returned reflects the file age at
  1355. the time the script started. See also <TT><B>$^T</B></TT> in the section
  1356. <A HREF="#specialvariables">Special Variables</A>.</TD></TR>
  1357. </TABLE>
  1358. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  1359. <!-- ----------------------------------------------------------------------------- -->
  1360. <A NAME="fileoperations"></A>
  1361. <H2>File Operations</H2>
  1362. Functions operating on a list of files return the number of files successfully
  1363. operated upon.
  1364. <DL>
  1365. <DT><B>chmod</B> <FONT SIZE="-1">LIST</FONT>
  1366. <DD>Changes the permissions of a list of files.
  1367. The first element of the list must be the numerical mode.
  1368. <DT><B>chown</B> <FONT SIZE="-1">LIST</FONT>
  1369. <DD>Changes the owner and group of a list of files.
  1370. The first two elements of the list must be the numerical uid and gid.
  1371. <DT><B>truncate</B> <FONT SIZE="-1">FILE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SIZE</FONT>
  1372. <DD>Truncates <FONT SIZE="-1">FILE</FONT> to <FONT SIZE="-1">SIZE</FONT>.
  1373. <FONT SIZE="-1">FILE</FONT> may be a filename or a filehandle.
  1374. <DT><B>link</B> <FONT SIZE="-1">OLDFILE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">NEWFILE</FONT>
  1375. <DD>Creates a new filename linked to the old filename.
  1376. <DT><B>lstat</B> <FONT SIZE="-1">FILE</FONT>
  1377. <DD>Like <B>stat</B>, but does not traverse a final symbolic link.
  1378. <DT><B>mkdir</B> <FONT SIZE="-1">DIR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">MODE</FONT>
  1379. <DD>Creates a directory with given permissions.
  1380. Sets <TT><B>$!</B></TT> on failure.
  1381. <DT><B>readlink</B> <FONT SIZE="-1">EXPR&#134;</FONT>
  1382. <DD>Returns the value of a symbolic link.
  1383. <DT><B>rename</B> <FONT SIZE="-1">OLDNAME</FONT><TT><B>,</B></TT> <FONT SIZE="-1">NEWNAME</FONT>
  1384. <DD>Changes the name of a file.
  1385. <DT><B>rmdir</B> <FONT SIZE="-1">FILENAME&#134;</FONT>
  1386. <DD>Deletes the directory if it is empty.
  1387. Sets <TT><B>$!</B></TT> on failure.
  1388. <DT><B>stat</B> <FONT SIZE="-1">FILE</FONT>
  1389. <DD>Returns a 13-element array
  1390. (0:&nbsp;<TT><B>$</B></TT>dev,
  1391. 1:&nbsp;<TT><B>$</B></TT>ino,
  1392. 2:&nbsp;<TT><B>$</B></TT>mode,
  1393. 3:&nbsp;<TT><B>$</B></TT>nlink,
  1394. 4:&nbsp;<TT><B>$</B></TT>uid,
  1395. 5:&nbsp;<TT><B>$</B></TT>gid,
  1396. 6:&nbsp;<TT><B>$</B></TT>rdev,
  1397. 7:&nbsp;<TT><B>$</B></TT>size,
  1398. 8:&nbsp;<TT><B>$</B></TT>atime,
  1399. 9:&nbsp;<TT><B>$</B></TT>mtime,
  1400. 10:&nbsp;<TT><B>$</B></TT>ctime,
  1401. 11:&nbsp;<TT><B>$</B></TT>blksize,
  1402. 12:&nbsp;<TT><B>$</B></TT>blocks).
  1403. <FONT SIZE="-1">FILE</FONT> can be a filehandle, an expression evaluating to a filename,
  1404. or <TT><B>_</B></TT> to refer to the last file test operation or <B>stat</B> call.
  1405. Returns a null list if the <B>stat</B> fails.
  1406. <DT><B>symlink</B> <FONT SIZE="-1">OLDFILE</FONT>, <FONT SIZE="-1">NEWFILE</FONT>
  1407. <DD>Creates a new filename symbolically linked to the old filename.
  1408. <DT><B>unlink</B> <FONT SIZE="-1">LIST</FONT>
  1409. <DD>Deletes a list of files.
  1410. <DT><B>utime</B> <FONT SIZE="-1">LIST</FONT>
  1411. <DD>Changes the access and modification times.
  1412. The first two elements of the list must be the numerical access and modification times.
  1413. </DL>
  1414. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  1415. <!-- ----------------------------------------------------------------------------- -->
  1416. <A NAME="input"></A>
  1417. <H2>Input / Output</H2>
  1418. In input/output operations, <FONT SIZE="-1">FILEHANDLE</FONT> may be a
  1419. filehandle as opened by the <B>open</B> operator, a predefined filehandle
  1420. (e.g., <TT><B>STDOUT</B></TT>) or a scalar variable that evaluates to the name of a
  1421. filehandle to be used.
  1422. <DL>
  1423. <DT><TT><B>&lt;</B></TT><FONT SIZE="-1">FILEHANDLE</FONT><TT><B>&gt;</B></TT>
  1424. <DD>In scalar context, reads a single line from the file opened on <FONT SIZE="-1">FILEHANDLE</FONT>.
  1425. In array context, reads the whole file.
  1426. <DT><TT><B>&lt;</B></TT> <TT><B>&gt;</B></TT>
  1427. <DD>Reads from the input stream formed by the files specified in
  1428. <TT><B>@ARGV</B></TT>, or standard input if no arguments were supplied.
  1429. <DT><B>binmode</B> <FONT SIZE="-1">FILEHANDLE</FONT>
  1430. <DD>Arranges for the file opened on <FONT SIZE="-1">FILEHANDLE</FONT> to be read
  1431. or written in <I>binary</I> mode as opposed to <I>text</I> mode (null operation on UNIX).
  1432. <DT><B>close</B> <FONT SIZE="-1">FILEHANDLE</FONT>
  1433. <DD>Closes the file or pipe associated with the filehandle.
  1434. <DT><B>dbmclose</B> <TT><B>%</B></TT><FONT SIZE="-1">HASH</FONT>
  1435. <DD>Depreciated, use <B>untie</B> instead.
  1436. <DT><B>dbmopen</B> <TT><B>%</B></TT><FONT SIZE="-1">HASH</FONT><TT><B>,</B></TT> <FONT SIZE="-1">DBMNAME</FONT><TT><B>,</B></TT> <FONT SIZE="-1">MODE</FONT>
  1437. <DD>Depreciated, use <B>tie</B> instead.
  1438. <DT><B>eof</B> <FONT SIZE="-1">FILEHANDLE</FONT>
  1439. <DD>Returns <B>true</B> if the next read will return end of file, or
  1440. if the file is not open.
  1441. <DT><B>eof</B>
  1442. <DD>Returns the EOF status for the last file read.
  1443. <DT><B>eof</B><TT><B>()</B></TT>
  1444. <DD>Indicates EOF on the pseudo file formed of the files
  1445. listed on the command line.
  1446. <DT><B>fcntl</B> <FONT SIZE="-1">FILEHANDLE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">FUNCTION</FONT><TT><B>,</B></TT> <TT><B>$</B></TT><FONT SIZE="-1">VAR</FONT>
  1447. <DD>Implements the <I>fcntl</I>(2) function. This function has
  1448. non-standard return values.
  1449. <DT><B>fileno</B> <FONT SIZE="-1">FILEHANDLE</FONT>
  1450. <DD>Returns the file descriptor for a given (open) file.
  1451. <DT><B>flock</B> <FONT SIZE="-1">FILEHANDLE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">OPERATION</FONT>
  1452. <DD>Calls <I>flock</I>(2) on the file.
  1453. <FONT SIZE="-1">OPERATION</FONT> formed by
  1454. adding 1 (shared),
  1455. 2 (exclusive), 4 (non-blocking), or 8 (unlock).
  1456. <DT><B>getc</B> [ <FONT SIZE="-1">FILEHANDLE</FONT> ]
  1457. <DD>Yields the next character from the file, or an empty
  1458. string on end of file. If <FONT SIZE="-1">FILEHANDLE</FONT> is omitted, reads
  1459. from <TT><B>STDIN</B></TT>.
  1460. <DT><B>ioctl</B> <FONT SIZE="-1">FILEHANDLE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">FUNCTION</FONT><TT><B>,</B></TT> <TT><B>$</B></TT><FONT SIZE="-1">VAR</FONT>
  1461. <DD>Performs <I>ioctl</I>(2) on the file. This function has non-standard
  1462. return values.
  1463. <DT><B>open</B> <FONT SIZE="-1">FILEHANDLE</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">FILENAME</FONT> ]
  1464. <DD>Opens a file and associates it with <FONT SIZE="-1">FILEHANDLE</FONT>. If
  1465. <FONT SIZE="-1">FILENAME</FONT> is omitted, the scalar variable of the same
  1466. name as the <FONT SIZE="-1">FILEHANDLE</FONT> must contain the filename.
  1467. <BR>
  1468. The following filename conventions apply when
  1469. opening a file.
  1470. <BR>
  1471. <TABLE CELLSPACING=0 CELLPADDING=0>
  1472. <TR><TD><TT><B>"</B></TT><FONT SIZE="-1">FILE</FONT><TT><B>"</B></TT></TD>
  1473. <TD>open <FONT SIZE="-1">FILE</FONT> for input.
  1474. Also <TT><B>"&lt;</B></TT><FONT SIZE="-1">FILE</FONT><TT><B>"</B></TT>.</TD></TR>
  1475. <TR><TD><TT><B>"&gt;</B></TT><FONT SIZE="-1">FILE</FONT><TT><B>"</B></TT></TD>
  1476. <TD>open <FONT SIZE="-1">FILE</FONT> for output, creating it if necessary.</TD></TR>
  1477. <TR><TD><TT><B>"&gt;&gt;</B></TT><FONT SIZE="-1">FILE</FONT><TT><B>"</B></TT></TD>
  1478. <TD>open <FONT SIZE="-1">FILE</FONT> in append mode.</TD></TR>
  1479. <TR><TD><TT><B>"+&gt;</B></TT><FONT SIZE="-1">FILE</FONT><TT><B>"</B></TT></TD>
  1480. <TD>open <FONT SIZE="-1">FILE</FONT> with read/write access.</TD></TR>
  1481. <TR><TD><TT><B>"|</B></TT><FONT SIZE="-1">CMD</FONT><TT><B>"</B></TT></TD>
  1482. <TD>opens a pipe to command <FONT SIZE="-1">CMD</FONT>;
  1483. forks if <FONT SIZE="-1">CMD</FONT> is <TT><B>-</B></TT>.</TD></TR>
  1484. <TR><TD><TT><B>"</B></TT><FONT SIZE="-1">CMD</FONT><TT><B>|"</B></TT></TD>
  1485. <TD>opens a pipe from command <FONT SIZE="-1">CMD</FONT>;
  1486. forks if <FONT SIZE="-1">CMD</FONT> is <TT><B>-</B></TT>.</TD></TR>
  1487. </TABLE>
  1488. <FONT SIZE="-1">FILE</FONT> may be <TT><B>&amp;</B></TT><FONT SIZE="-1">FILEHND</FONT>
  1489. in which case the new filehandle is connected to the (previously opened)
  1490. filehandle <FONT SIZE="-1">FILEHND</FONT>.
  1491. If it is <TT><B>&amp;=</B></TT><FONT SIZE="-1">N</FONT>, <FONT SIZE="-1">FILE</FONT> will be connected to the given file descriptor.
  1492. <B>open</B> returns <B>undef</B> upon failure, <B>true</B> otherwise.
  1493. <DT><B>pipe</B> <FONT SIZE="-1">READHANDLE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">WRITEHANDLE</FONT><TT><B>)</B></TT>
  1494. <DD>Returns a pair of connected pipes.
  1495. <DT><B>print</B> [ <FONT SIZE="-1">FILEHANDLE</FONT> ] [ <FONT SIZE="-1">LIST&#134;</FONT> ]
  1496. <DD>Equivalent to <B>print</B> <FONT SIZE="-1">FILEHANDLE</FONT> <B>sprintf</B> <FONT SIZE="-1">LIST</FONT>.
  1497. <DT><B>printf</B>[<TT><B>(</B></TT>[<FONT SIZE="-1">FILEHANDLE</FONT>] <FONT SIZE="-1">LIST&#134;</FONT><TT><B>)</B></TT>*]
  1498. <DD>Equivalent to <B>print</B> <FONT SIZE="-1">FILEHANDLE</FONT>
  1499. <B>sprintf</B><TT><B>(</B></TT><FONT SIZE="-1">LIST</FONT><TT><B>)</B></TT>.
  1500. <DT><B>read</B> <FONT SIZE="-1">FILEHANDLE</FONT><TT><B>,</B></TT> <TT><B>$</B></TT><FONT SIZE="-1">VAR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LENGTH</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">OFFSET</FONT> ]
  1501. <DD>Reads <FONT SIZE="-1">LENGTH</FONT> binary bytes from the file into the
  1502. variable at <FONT SIZE="-1">OFFSET</FONT>. Returns number of bytes actually read.
  1503. <DT><B>seek</B> <FONT SIZE="-1">FILEHANDLE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">POSITION</FONT><TT><B>,</B></TT> <FONT SIZE="-1">WHENCE</FONT>
  1504. <DD>Arbitarily positions the file.
  1505. Returns <B>true</B> if successful.
  1506. <DT><B>select</B> [ <FONT SIZE="-1">FILEHANDLE</FONT> ]
  1507. <DD>Returns the currently selected filehandle. Sets the
  1508. current default filehandle for output operations if
  1509. <FONT SIZE="-1">FILEHANDLE</FONT> is supplied.
  1510. <DT><B>select</B> <FONT SIZE="-1">RBITS</FONT><TT><B>,</B></TT> <FONT SIZE="-1">WBITS</FONT><TT><B>,</B></TT> <FONT SIZE="-1">NBITS</FONT><TT><B>,</B></TT> <FONT SIZE="-1">TIMEOUT</FONT>
  1511. <DD>Performs a <I>select</I>(2) system call with the same
  1512. parameters.
  1513. <DT><B>sprintf</B> <FONT SIZE="-1">FORMAT</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LIST</FONT>
  1514. <DD>Returns a string formatted by (almost all of) the
  1515. usual <I>printf</I>(3) conventions.
  1516. <DT><B>sysread</B> <FONT SIZE="-1">FILEHANDLE</FONT><TT><B>,</B></TT> <TT><B>$</B></TT><FONT SIZE="-1">VAR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LENGTH</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">OFFSET</FONT> ]
  1517. <DD>Reads <FONT SIZE="-1">LENGTH</FONT> bytes into
  1518. <TT><B>$</B></TT><FONT SIZE="-1">VAR</FONT> at <FONT SIZE="-1">OFFSET</FONT>.
  1519. <DT><B>syswrite</B> <FONT SIZE="-1">FILEHANDLE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SCALAR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LENGTH</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">OFFSET</FONT> ]
  1520. <DD>Writes <FONT SIZE="-1">LENGTH</FONT> bytes from <FONT SIZE="-1">SCALAR</FONT> at <FONT SIZE="-1">OFFSET</FONT>.
  1521. <DT><B>tell</B> [ <FONT SIZE="-1">FILEHANDLE</FONT> ]
  1522. <DD>Returns the current file position for the file.
  1523. If <FONT SIZE="-1">FILENAME</FONT> is omitted, assumes the file last read.
  1524. <DT><B>write</B> [ <FONT SIZE="-1">FILEHANDLE</FONT> ]
  1525. <DD>Writes a formatted record to the specified file, using the format associated
  1526. with that file.
  1527. </DL>
  1528. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  1529. <!-- ----------------------------------------------------------------------------- -->
  1530. <A NAME="formats"></A>
  1531. <H2>Formats</H2>
  1532. <DL>
  1533. <DT><B>formline</B> <FONT SIZE="-1">PICTURE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LIST</FONT>
  1534. <DD>Formats <FONT SIZE="-1">LIST</FONT> according to <FONT SIZE="-1">PICTURE</FONT>
  1535. and accumulates the result into <TT><B>$^A</B></TT>.
  1536. <DT><B>write</B> [ <FONT SIZE="-1">FILEHANDLE</FONT> ]
  1537. <DD>Writes a formatted record to the specified file, using the format associated
  1538. with that file.
  1539. </DL>
  1540. <P>Formats are defined as follows:</P>
  1541. <UL>
  1542. <B>format</B> [<FONT SIZE="-1">NAME</FONT>] <TT><B>=</B></TT><BR>
  1543. <FONT SIZE="-1">FORMLIST</FONT><BR>
  1544. <TT><B>.</B></TT>
  1545. </UL>
  1546. <P><FONT SIZE="-1">FORMLIST</FONT> pictures the lines, and contains the arguments which will
  1547. give values to the fields in the lines. <FONT SIZE="-1">NAME</FONT> defaults to
  1548. <TT><B>STDOUT</TT></B> if omitted.</P>
  1549. <P>Picture fields are:</P>
  1550. <UL>
  1551. <TABLE CELLSPACING=0 CELLPADDING=0>
  1552. <TR>
  1553. <TD><TT><B>@&lt;&lt;&lt;</B></TT>...</TD>
  1554. <TD>left adjusted field, repeat the <TT><B>&lt;</B></TT> to denote the desired width</TD>
  1555. </TR>
  1556. <TR>
  1557. <TD><TT><B>@&gt;&gt;&gt;</B></TT>...</TD>
  1558. <TD>right adjusted field</TD>
  1559. </TR>
  1560. <TR>
  1561. <TD><TT><B>@|||</B></TT>...</TD>
  1562. <TD>centered field</TD>
  1563. </TR>
  1564. <TR>
  1565. <TD><TT><B>@#.##</B></TT>...&nbsp;&nbsp;&nbsp;</TD>
  1566. <TD>numeric format with implied decimal point</TD>
  1567. </TR>
  1568. <TR>
  1569. <TD><TT><B>@*</B></TT></TD>
  1570. <TD>a multi-line field</TD>
  1571. </TR>
  1572. </TABLE>
  1573. </UL>
  1574. Use <TT><B>^</B></TT> instead of <TT><B>@</B></TT> for multiline block filling.<BR>
  1575. Use <TT><B>~</B></TT> at the beginning of a line to suppress unwanted empty lines.<BR>
  1576. Use <TT><B>~~</B></TT> at the beginning of a line to have this format line repeated until
  1577. all fields are exhausted.<BR>
  1578. Use <TT><B>$-</B></TT> to zero to force a page break on the next <B>write</B>.<BR>
  1579. See also <TT><B>$^</B></TT>, <TT><B>$~</B></TT>, <TT><B>$^A</B></TT>, <TT><B>$^F</B></TT>,
  1580. <TT><B>$-</B></TT> and <TT><B>$=</B></TT> in section
  1581. <A HREF="#specialvariables">Special Variables</A>.
  1582. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  1583. <!-- ----------------------------------------------------------------------------- -->
  1584. <A NAME="directory"></A>
  1585. <H2>Directory Reading Routines</H2>
  1586. <DL>
  1587. <DT><B>closedir</B> <FONT SIZE="-1">DIRHANDLE</FONT>
  1588. <DD>Closes a directory opened by <B>opendir</B>.
  1589. <DT><B>opendir</B> <FONT SIZE="-1">DIRHANDLE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">DIRNAME</FONT>
  1590. <DD>Opens a directory on the handle specified.
  1591. <DT><B>readdir</B> <FONT SIZE="-1">DIRHANDLE</FONT>
  1592. <DD>Returns the next entry (or an array of entries) from the directory.
  1593. <DT><B>rewinddir</B> <FONT SIZE="-1">DIRHANDLE</FONT>
  1594. <DD>Positions the directory to the beginning.
  1595. <DT><B>seekdir</B> <FONT SIZE="-1">DIRHANDLE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">POS</FONT>
  1596. <DD>Sets position for <B>readdir</B> on the directory.
  1597. <DT><B>telldir</B> <FONT SIZE="-1">DIRHANDLE</FONT>
  1598. <DD>Returns the position in the directory.
  1599. </DL>
  1600. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  1601. <!-- ----------------------------------------------------------------------------- -->
  1602. <A NAME="systeminteraction"></A>
  1603. <H2>System Interaction</H2>
  1604. <DL>
  1605. <DT><B>alarm</B> <FONT SIZE="-1">EXPR</FONT>
  1606. <DD>Schedules a <TT><B>SIGALRM</B></TT> to be delivered
  1607. after <FONT SIZE="-1">EXPR</FONT> seconds.
  1608. <DT><B>chdir</B> [ <FONT SIZE="-1">EXPR</FONT> ]
  1609. <DD>Changes the working directory.
  1610. Uses <TT><B>$ENV{"HOME"}</TT></B> or <TT><B>$ENV{"LOGNAME"}</TT></B> if <FONT SIZE="-1">EXPR</FONT> is omitted.
  1611. <DT><B>chroot</B> <FONT SIZE="-1">FILENAME&#134;</FONT>
  1612. <DD>Changes the root directory for the process and its children.
  1613. <DT><B>die</B> [ <FONT SIZE="-1">LIST</FONT> ]
  1614. <DD>Prints the value of <FONT SIZE="-1">LIST</FONT> to <TT><B>STDERR</B></TT>
  1615. and exits with the current value of <TT><B>$!</B></TT> (errno).
  1616. If <TT><B>$!</B></TT> is 0, exits with the value of <TT><B>($? &gt;&gt; 8)</B></TT>.
  1617. If <TT><B>($? &gt;&gt; 8)</B></TT> is 0, exits with 255.
  1618. <FONT SIZE="-1">LIST</FONT> defaults to "<TT><B>Died</B></TT>".
  1619. <DT><B>exec</B> <FONT SIZE="-1">LIST</FONT>
  1620. <DD>Executes the system command in <FONT SIZE="-1">LIST</FONT>; does not return.
  1621. <DT><B>exit</B> <FONT SIZE="-1">EXPR</FONT>
  1622. <DD>Exits immediately with the value of <FONT SIZE="-1">EXPR</FONT>,
  1623. which defaults to <TT><B>0</TT></B> (zero).
  1624. Calls <TT><B>END</TT></B> routines and object destructors before exiting.
  1625. <DT><B>fork</B>
  1626. <DD>Does a <I>fork</I>(2) system call.
  1627. Returns the process ID of the child to the parent process and zero to the child process.
  1628. <DT><B>getlogin</B>
  1629. <DD>Returns the current login name as known by the system.
  1630. <DT><B>getpgrp</B> [ <FONT SIZE="-1">PID</FONT> ]
  1631. <DD>Returns the process group for process <FONT SIZE="-1">PID</FONT>
  1632. (0, or omitted, means the current process).
  1633. <DT><B>getppid</B>
  1634. <DD>Returns the process ID of the parent process.
  1635. <DT><B>getpriority</B> <FONT SIZE="-1">WHICH</FONT><TT><B>,</B></TT> <FONT SIZE="-1">WHO</FONT>
  1636. <DD>Returns the current priority for a process, process group, or user.
  1637. <DT><B>glob</B> <FONT SIZE="-1">PAT</FONT>
  1638. <DD>Returns a list of filenames that match the shell pattern <FONT SIZE="-1">PAT</FONT>.
  1639. <DT><B>kill</B> <FONT SIZE="-1">LIST</FONT>
  1640. <DD>Sends a signal to a list of processes.
  1641. The first element of the list must be the signal to send
  1642. (either numeric, or its name as a string).
  1643. <DT><B>setpgrp</B> <FONT SIZE="-1">PID</FONT><TT><B>,</B></TT> <FONT SIZE="-1">PGRP</FONT>
  1644. <DD>Sets the process group for the <FONT SIZE="-1">PID</FONT> (0 means the current process).
  1645. <DT><B>setpriority</B> <FONT SIZE="-1">WHICH</FONT><TT><B>,</B></TT> <FONT SIZE="-1">WHO</FONT><TT><B>,</B></TT> <FONT SIZE="-1">PRIORITY</FONT>
  1646. <DD>Sets the current priority for a process, process group, or a user.
  1647. <DT><B>sleep</B> [ <FONT SIZE="-1">EXPR</FONT> ]
  1648. <DD>Causes the program to sleep for <FONT SIZE="-1">EXPR</FONT> seconds,
  1649. or forever if no <FONT SIZE="-1">EXPR</FONT>.
  1650. Returns the number of seconds actually slept.
  1651. <DT><B>syscall</B> <FONT SIZE="-1">LIST</FONT>
  1652. <DD>Calls the system call specified in the first element of the list, passing the
  1653. rest of the list as arguments to the call.
  1654. <DT><B>system</B> <FONT SIZE="-1">LIST</FONT>
  1655. <DD>Does exactly the same thing as <B>exec</B> <FONT SIZE="-1">LIST</FONT>
  1656. except that a fork is performed first,
  1657. and the parent process waits for the child process to complete.
  1658. <DT><B>times</B>
  1659. <DD>Returns a 4-element array
  1660. (0:&nbsp;<TT><B>$</B></TT>user,
  1661. 1:&nbsp;<TT><B>$</B></TT>system,
  1662. 2:&nbsp;<TT><B>$</B></TT>cursor,
  1663. 3:&nbsp;<TT><B>$</B></TT>csystem)
  1664. giving the user and system times, in seconds, for this process
  1665. and the children of this process.
  1666. <DT><B>umask</B> [ <FONT SIZE="-1">EXPR</FONT> ]
  1667. <DD>Sets the umask for the process and returns the old one.
  1668. If <FONT SIZE="-1">EXPR</FONT> is omitted, returns current umask value.
  1669. <DT><B>wait</B>
  1670. <DD>Waits for a child process to terminate and returns the process ID of the
  1671. deceased process (-1 if none). The status is returned in <TT><B>$?</B></TT>.
  1672. <DT><B>waitpid</B> <FONT SIZE="-1">PID</FONT><TT><B>,</B></TT> <FONT SIZE="-1">FLAGS</FONT>
  1673. <DD>Performs the same function as the corresponding system call.
  1674. <DT><B>warn</B> [ <FONT SIZE="-1">LIST</FONT> ]
  1675. <DD>Prints the message on <TT><B>STDERR</B></TT> like <B>die</B>, but doesn't exit.
  1676. <FONT SIZE="-1">LIST</FONT> defaults to "<TT><B>Warning: something's wrong</TT></B>".
  1677. </DL>
  1678. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  1679. <!-- ----------------------------------------------------------------------------- -->
  1680. <A NAME="networking"></A>
  1681. <H2>Networking</H2>
  1682. <DL>
  1683. <DT><B>accept</B> <FONT SIZE="-1">NEWSOCKET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">GENERICSOCKET</FONT>
  1684. <DD>Accepts a new socket.
  1685. <DT><B>bind</B> <FONT SIZE="-1">SOCKET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">NAME</FONT>
  1686. <DD>Binds the <FONT SIZE="-1">NAME</FONT> to the <FONT SIZE="-1">SOCKET</FONT>.
  1687. <DT><B>connect</B> <FONT SIZE="-1">SOCKET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">NAME</FONT>
  1688. <DD>Connects the <FONT SIZE="-1">NAME</FONT> to the <FONT SIZE="-1">SOCKET</FONT>.
  1689. <DT><B>getpeername</B> <FONT SIZE="-1">SOCKET</FONT>
  1690. <DD>Returns the socket address of the other end of the <FONT SIZE="-1">SOCKET</FONT>.
  1691. <DT><B>getsockname</B> <FONT SIZE="-1">SOCKET</FONT>
  1692. <DD>Returns the name of the <FONT SIZE="-1">SOCKET</FONT>.
  1693. <DT><B>getsockopt</B> <FONT SIZE="-1">SOCKET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LEVEL</FONT><TT><B>,</B></TT> <FONT SIZE="-1">OPTNAME</FONT>
  1694. <DD>Returns the socket options.
  1695. <DT><B>listen</B> <FONT SIZE="-1">SOCKET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">QUEUESIZE</FONT>
  1696. <DD>Starts listening on the specified <FONT SIZE="-1">SOCKET</FONT>.
  1697. <DT><B>recv</B> <FONT SIZE="-1">SOCKET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SCALAR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LENGTH</FONT><TT><B>,</B></TT> <FONT SIZE="-1">FLAGS</FONT>
  1698. <DD>Receives a message on <FONT SIZE="-1">SOCKET</FONT>.
  1699. <DT><B>send</B> <FONT SIZE="-1">SOCKET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">MSG</FONT><TT><B>,</B></TT> <FONT SIZE="-1">FLAGS</FONT> [ <TT><B>,</B></TT> <FONT SIZE="-1">TO</FONT> ]
  1700. <DD>Sends a message on the <FONT SIZE="-1">SOCKET</FONT>.
  1701. <DT><B>setsockopt</B> <FONT SIZE="-1">SOCKET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">LEVEL</FONT><TT><B>,</B></TT> <FONT SIZE="-1">OPTNAME</FONT><TT><B>,</B></TT> <FONT SIZE="-1">OPTVAL</FONT>
  1702. <DD>Sets the requested socket option.
  1703. <DT><B>shutdown</B> <FONT SIZE="-1">SOCKET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">HOW</FONT>
  1704. <DD>Shuts down a <FONT SIZE="-1">SOCKET</FONT>.
  1705. <DT><B>socket</B> <FONT SIZE="-1">SOCKET</FONT><TT><B>,</B></TT> <FONT SIZE="-1">DOMAIN</FONT><TT><B>,</B></TT> <FONT SIZE="-1">TYPE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">PROTOCOL</FONT>
  1706. <DD>Creates a <FONT SIZE="-1">SOCKET</FONT> in <FONT SIZE="-1">DOMAIN</FONT> with <FONT SIZE="-1">TYPE</FONT> and <FONT SIZE="-1">PROTOCOL</FONT>.
  1707. <DT><B>socketpair</B> <FONT SIZE="-1">SOCKET1</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SOCKET2</FONT><TT><B>,</B></TT> <FONT SIZE="-1">DOMAIN</FONT><TT><B>,</B></TT> <FONT SIZE="-1">TYPE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">PROTOCOL</FONT>
  1708. <DD>Works the same as <B>socket</B>, but creates a pair of bidirectional sockets.
  1709. </DL>
  1710. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  1711. <!-- ----------------------------------------------------------------------------- -->
  1712. <A NAME="systemv"></A>
  1713. <H2>System V IPC</H2>
  1714. <P>You need to<TT><B> require "sys/ipc.ph" </TT></B>before you can use the
  1715. symbolic names of the operations.</P>
  1716. <DL>
  1717. <DT><B>msgctl</B> <FONT SIZE="-1">ID</FONT><TT><B>,</B></TT> <FONT SIZE="-1">CMD</FONT><TT><B>,</B></TT> <FONT SIZE="-1">ARGS</FONT>
  1718. <DD>Calls <I>msgctl</I>(2). If <FONT SIZE="-1">CMD</FONT> is <TT><B>&amp;IPC_STAT</TT></B> then <FONT SIZE="-1">ARGS</FONT> must
  1719. be a variable.
  1720. <DT><B>msgget</B> <FONT SIZE="-1">KEY</FONT><TT><B>,</B></TT> <FONT SIZE="-1">FLAGS</FONT>
  1721. <DD>Creates a message queue for <FONT SIZE="-1">KEY</FONT>.
  1722. Returns the message queue identifier.
  1723. <DT><B>msgsnd</B> <FONT SIZE="-1">ID</FONT><TT><B>,</B></TT> <FONT SIZE="-1">MSG</FONT><TT><B>,</B></TT> <FONT SIZE="-1">FLAGS</FONT>
  1724. <DD>Sends <FONT SIZE="-1">MSG</FONT> to queue <FONT SIZE="-1">ID</FONT>.
  1725. <DT><B>msgrcv</B> <FONT SIZE="-1">ID</FONT><TT><B>,</B></TT> <TT><B>$</TT></B><FONT SIZE="-1">VAR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SIZE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">TYPE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">FLAGS</FONT>
  1726. <DD>Receives a message from queue <FONT SIZE="-1">ID</FONT> into <FONT SIZE="-1">VAR</FONT>.
  1727. <DT><B>semctl</B> <FONT SIZE="-1">ID</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SEMNUM</FONT><TT><B>,</B></TT> <FONT SIZE="-1">CMD</FONT><TT><B>,</B></TT> <FONT SIZE="-1">ARG</FONT>
  1728. <DD>Calls <I>semctl</I>(2).
  1729. If <FONT SIZE="-1">CMD</FONT> is <TT><B>&amp;IPC_STAT</TT></B> of <TT><B>&amp;GETALL</TT></B>
  1730. then <FONT SIZE="-1">ARG</FONT> must be a variable.
  1731. <DT><B>semget</B> <FONT SIZE="-1">KEY</FONT><TT><B>,</B></TT> <FONT SIZE="-1">NSEMS</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SIZE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">FLAGS</FONT>
  1732. <DD>Creates a set of semaphores for <FONT SIZE="-1">KEY</FONT>.
  1733. Returns the message semaphore identifier.
  1734. <DT><B>semop</B> <FONT SIZE="-1">KEY</FONT><TT><B>,</B></TT> ...
  1735. <DD>Performs semaphore operations.
  1736. <DT><B>shmctl</B> <FONT SIZE="-1">ID</FONT><TT><B>,</B></TT> <FONT SIZE="-1">CMD</FONT><TT><B>,</B></TT> <FONT SIZE="-1">ARG</FONT>
  1737. <DD>Calls <I>shmctl</I>(2).
  1738. If <FONT SIZE="-1">CMD</FONT> is <TT><B>&amp;IPC_STAT</TT></B>
  1739. then <FONT SIZE="-1">ARG</FONT> must be a variable.
  1740. <DT><B>shmget</B> <FONT SIZE="-1">KEY</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SIZE</FONT><TT><B>,</B></TT> <FONT SIZE="-1">FLAGS</FONT>
  1741. <DD>Creates shared memory.
  1742. Returns the shared memory segment identifier.
  1743. <DT><B>shmread</B> <FONT SIZE="-1">ID</FONT><TT><B>,</B></TT> <TT><B>$</TT></B><FONT SIZE="-1">VAR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">POS</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SIZE</FONT>
  1744. <DD>Reads at most <FONT SIZE="-1">SIZE</FONT> bytes of the contents of shared
  1745. memory segment <FONT SIZE="-1">ID</FONT> starting at offset <FONT SIZE="-1">POS</FONT> into <FONT SIZE="-1">VAR</FONT>.
  1746. <DT><B>shmwrite</B> <FONT SIZE="-1">ID</FONT><TT><B>,</B></TT> <FONT SIZE="-1">STRING</FONT><TT><B>,</B></TT> <FONT SIZE="-1">POS</FONT><TT><B>,</B></TT> <FONT SIZE="-1">SIZE</FONT>
  1747. <DD>Writes at most <FONT SIZE="-1">SIZE</FONT> bytes of <FONT SIZE="-1">STRING</FONT> into the contents of
  1748. shared memory segment <FONT SIZE="-1">ID</FONT> at offset <FONT SIZE="-1">POS</FONT>.
  1749. </DL>
  1750. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  1751. <!-- ----------------------------------------------------------------------------- -->
  1752. <A NAME="miscellaneous"></A>
  1753. <H2>Miscellaneous</H2>
  1754. <DL>
  1755. <DT><B>defined</B> <FONT SIZE="-1">EXPR</FONT>
  1756. <DD>Tests whether the lvalue <FONT SIZE="-1">EXPR</FONT> has an actual value.
  1757. <DT><B>do</B> <FONT SIZE="-1">FILENAME</FONT>
  1758. <DD>Executes <FONT SIZE="-1">FILENAME</FONT> as a Perl script.
  1759. See also <B>require</B> in the section
  1760. <A HREF="#subroutines">Subroutines, Packages and Modules</A>.
  1761. <DT><B>dump</B> [ <FONT SIZE="-1">LABEL</FONT> ]
  1762. <DD>Immediate core dump.
  1763. When reincarnated, starts at <FONT SIZE="-1">LABEL</FONT>.
  1764. <DT><B>eval</B> <TT><B>{</TT></B> <FONT SIZE="-1">EXPR</FONT> <TT><B>;</TT></B> ... <TT><B>}</TT></B>
  1765. <DD>Executes the code between <TT><B>{</TT></B> and <TT><B>}</TT></B>.
  1766. Traps runtime errors as described
  1767. with <B>eval</B><TT><B>(</TT></B><FONT SIZE="-1">EXPR</FONT><TT><B>)</TT></B>, in the section <A HREF="#string">String Functions</A>.
  1768. <DT><B>local</B> <FONT SIZE="-1">VARIABLE</FONT>
  1769. <DT><B>local</B> <TT><B>(</TT></B> <FONT SIZE="-1">LIST</FONT> <TT><B>)</TT></B>
  1770. <DD>Creates a scope for the listed variables local to the enclosing block,
  1771. subroutine or <B>eval</B>.
  1772. <DT><B>my</B> <FONT SIZE="-1">VARIABLE</FONT>
  1773. <DT><B>my</B> <TT><B>(</TT></B> <FONT SIZE="-1">LIST</FONT> <TT><B>)</TT></B>
  1774. <DD>Creates a scope for the listed variables lexically local to the enclosing block,
  1775. subroutine or <B>eval</B>.
  1776. <DT><B>ref</B> <FONT SIZE="-1">EXPR&#134;</FONT>
  1777. <DD>Returns a <B>true</B> value if <FONT SIZE="-1">EXPR</FONT> is a reference.
  1778. Returns the package name if <FONT SIZE="-1">EXPR</FONT> has been blessed into a package.
  1779. <DT><B>reset</B> [ <FONT SIZE="-1">EXPR</FONT> ]
  1780. <DD>Resets <TT><B>??</B></TT> searches so that they work again.
  1781. <FONT SIZE="-1">EXPR</FONT> is a list of single letters. All variables and arrays
  1782. beginning with one of those letters are reset
  1783. to their pristine state. Only affects the current package.
  1784. <DT><B>scalar</B> <FONT SIZE="-1">EXPR</FONT>
  1785. <DD>Forces evaluation of <FONT SIZE="-1">EXPR</FONT> in scalar context.
  1786. <DT><B>undef</B> [ <FONT SIZE="-1">LVALUE</FONT> ]
  1787. <DD>Undefines the <FONT SIZE="-1">LVALUE</FONT>. Always returns the undefined value.
  1788. <DT><B>wantarray</B>
  1789. <DD>Returns <B>true</B> if the current context expects an array value.
  1790. </DL>
  1791. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  1792. <!-- ----------------------------------------------------------------------------- -->
  1793. <A NAME="information"></A>
  1794. <H2>Information from System Files</H2>
  1795. <TABLE CELLSPACING=0 CELLPADDING=0>
  1796. <TR>
  1797. <TD COLSPAN=2><LI><FONT SIZE="+1"><B>passwd</B></FONT></TD>
  1798. </TR>
  1799. <TR>
  1800. <TD COLSPAN=2>Returns <TT><B>($</B></TT>name, <TT><B>$</B></TT>passwd,
  1801. <TT><B>$</B></TT>uid, <TT><B>$</B></TT>gid, <TT><B>$</B></TT>quota,
  1802. <TT><B>$</B></TT>comment, <TT><B>$</B></TT>gcos, <TT><B>$</B></TT>dir,
  1803. <TT><B>$</B></TT>shell<TT><B>)</TT></B>.</TD>
  1804. </TR>
  1805. <TR>
  1806. <TD><B>endpwent</B></TD>
  1807. <TD>Ends lookup processing.</TD>
  1808. </TR>
  1809. <TR>
  1810. <TD><B>getpwend</B></TD>
  1811. <TD>Gets next user information.</TD>
  1812. </TR>
  1813. <TR>
  1814. <TD><B>getpwnam</B> <FONT SIZE="-1">NAME</FONT></TD>
  1815. <TD>Gets information by name.</TD>
  1816. </TR>
  1817. <TR>
  1818. <TD><B>getpwuid</B> <FONT SIZE="-1">UID</FONT></TD>
  1819. <TD>Gets information by user ID.</TD>
  1820. </TR>
  1821. <TR>
  1822. <TD><B>setpwent</B></TD>
  1823. <TD>Resets lookup processing.</TD>
  1824. </TR>
  1825. <TR><TD COLSPAN=2>&nbsp;</TD></TR>
  1826. <TR>
  1827. <TD COLSPAN=2><LI><FONT SIZE="+1"><B>group</B></FONT></TD>
  1828. </TR>
  1829. <TR>
  1830. <TD COLSPAN=2>Returns <TT><B>($</B></TT>name, <TT><B>$</B></TT>passwd,
  1831. <TT><B>$</B></TT>gid, <TT><B>$</B></TT>members<TT><B>)</TT></B>.</TD>
  1832. </TR>
  1833. <TR>
  1834. <TD><B>endgrent</B></TD>
  1835. <TD>Ends lookup processing.</TD>
  1836. </TR>
  1837. <TR>
  1838. <TD><B>getgrgid</B> <FONT SIZE="-1">GID</FONT></TD>
  1839. <TD>Gets information by group ID.</TD>
  1840. </TR>
  1841. <TR>
  1842. <TD><B>getgrnam</B> <FONT SIZE="-1">NAME</FONT></TD>
  1843. <TD>Gets information by name.</TD>
  1844. </TR>
  1845. <TR>
  1846. <TD><B>getgrent</B></TD>
  1847. <TD>Gets next information.</TD>
  1848. </TR>
  1849. <TR>
  1850. <TD><B>setgrent</B></TD>
  1851. <TD>Resets lookup processing.</TD>
  1852. </TR>
  1853. <TR><TD COLSPAN=2>&nbsp;</TD></TR>
  1854. <TR>
  1855. <TD COLSPAN=2><LI><FONT SIZE="+1"><B>hosts</B></FONT></TD>
  1856. </TR>
  1857. <TR>
  1858. <TD COLSPAN=2>Returns <TT><B>($</B></TT>name, <TT><B>$</B></TT>aliases,
  1859. <TT><B>$</B></TT>addrtype, <TT><B>$</B></TT>length, <TT><B>@</B></TT>addrs<TT><B>)</TT></B>.</TD>
  1860. </TR>
  1861. <TR>
  1862. <TD><B>endhostent</B></TD>
  1863. <TD>Ends lookup processing.</TD>
  1864. </TR>
  1865. <TR>
  1866. <TD><B>gethostbyaddr</B> <FONT SIZE="-1">ADDR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">ADDRTYPE</FONT></TD>
  1867. <TD>Gets information by IP address.</TD>
  1868. </TR>
  1869. <TR>
  1870. <TD><B>gethostbyname</B> <FONT SIZE="-1">NAME</FONT></TD>
  1871. <TD>Gets information by hostname.</TD>
  1872. </TR>
  1873. <TR>
  1874. <TD><B>gethostent</B></TD>
  1875. <TD>Gets next host information.</TD>
  1876. </TR>
  1877. <TR>
  1878. <TD><B>sethostent</B> <FONT SIZE="-1">STAYOPEN</FONT></TD>
  1879. <TD>Resets lookup processing.</TD>
  1880. </TR>
  1881. <TR><TD COLSPAN=2>&nbsp;</TD></TR>
  1882. <TR>
  1883. <TD COLSPAN=2><LI><FONT SIZE="+1"><B>networks</B></FONT></TD>
  1884. </TR>
  1885. <TR>
  1886. <TD COLSPAN=2>Returns <TT><B>($</B></TT>name, <TT><B>$</B></TT>aliases,
  1887. <TT><B>$</B></TT>addrtype, <TT><B>$</B></TT>net<TT><B>)</TT></B>.</TD>
  1888. </TR>
  1889. <TR>
  1890. <TD><B>endnetent</B></TD>
  1891. <TD>Ends lookup processing.</TD>
  1892. </TR>
  1893. <TR>
  1894. <TD><B>getnetbyaddr</B> <FONT SIZE="-1">ADDR</FONT><TT><B>,</B></TT> <FONT SIZE="-1">TYPE</FONT></TD>
  1895. <TD>Gets information by address and type.</TD>
  1896. </TR>
  1897. <TR>
  1898. <TD><B>getnetbyname</B> <FONT SIZE="-1">NAME</FONT></TD>
  1899. <TD>Gets information by network name.</TD>
  1900. </TR>
  1901. <TR>
  1902. <TD><B>getnetent</B></TD>
  1903. <TD>Gets next network information.</TD>
  1904. </TR>
  1905. <TR>
  1906. <TD><B>setnetent</B> <FONT SIZE="-1">STAYOPEN</FONT></TD>
  1907. <TD>Resets lookup processing.</TD>
  1908. </TR>
  1909. <TR><TD COLSPAN=2>&nbsp;</TD></TR>
  1910. <TR>
  1911. <TD COLSPAN=2><LI><FONT SIZE="+1"><B>services</B></FONT></TD>
  1912. </TR>
  1913. <TR>
  1914. <TD COLSPAN=2>Returns <TT><B>($</B></TT>name, <TT><B>$</B></TT>aliases,
  1915. <TT><B>$</B></TT>port, <TT><B>$</B></TT>proto<TT><B>)</TT></B>.</TD>
  1916. </TR>
  1917. <TR>
  1918. <TD><B>endservent</B></TD>
  1919. <TD>Ends lookup processing.</TD>
  1920. </TR>
  1921. <TR>
  1922. <TD><B>getservbyname</B> <FONT SIZE="-1">NAME</FONT><TT><B>,</B></TT> <FONT SIZE="-1">PROTO</FONT></TD>
  1923. <TD>Gets information by service name.</TD>
  1924. </TR>
  1925. <TR>
  1926. <TD><B>getservbyport</B> <FONT SIZE="-1">PORT</FONT><TT><B>,</B></TT> <FONT SIZE="-1">PROTO</FONT></TD>
  1927. <TD>Gets information by service port.</TD>
  1928. </TR>
  1929. <TR>
  1930. <TD><B>getservent</B></TD>
  1931. <TD>Gets next service information.</TD>
  1932. </TR>
  1933. <TR>
  1934. <TD><B>setservent</B> <FONT SIZE="-1">STAYOPEN</FONT></TD>
  1935. <TD>Resets lookup processing.</TD>
  1936. </TR>
  1937. <TR><TD COLSPAN=2>&nbsp;</TD></TR>
  1938. <TR>
  1939. <TD COLSPAN=2><LI><FONT SIZE="+1"><B>protocols</B></FONT></TD>
  1940. </TR>
  1941. <TR>
  1942. <TD COLSPAN=2>Returns <TT><B>($</B></TT>name, <TT><B>$</B></TT>aliases,
  1943. <TT><B>$</B></TT>proto<TT><B>)</TT></B>.</TD>
  1944. </TR>
  1945. <TR>
  1946. <TD><B>endprotoent</B></TD>
  1947. <TD>Ends lookup processing.</TD>
  1948. </TR>
  1949. <TR>
  1950. <TD><B>getprotobyname</B> <FONT SIZE="-1">NAME</FONT></TD>
  1951. <TD>Gets information by protocol name.</TD>
  1952. </TR>
  1953. <TR>
  1954. <TD><B>getprotobynumber</B> <FONT SIZE="-1">NUMBER</FONT></TD>
  1955. <TD>Gets information by protocol number.</TD>
  1956. </TR>
  1957. <TR>
  1958. <TD><B>getprotoent</B></TD>
  1959. <TD>Gets next protocol information.</TD>
  1960. </TR>
  1961. <TR>
  1962. <TD><B>setprotoent</B> <FONT SIZE="-1">STAYOPEN</FONT></TD>
  1963. <TD>Resets lookup processing.</TD>
  1964. </TR>
  1965. </TABLE>
  1966. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  1967. <!-- ----------------------------------------------------------------------------- -->
  1968. <A NAME="specialvariables"></A>
  1969. <H2>Special Variables</H2>
  1970. <TABLE CELLSPACING=0 CELLPADDING=0>
  1971. <TR><TD VALIGN=top COLSPAN=2>The following variables are global and should be
  1972. localized in subroutines:</TD></TR>
  1973. <TR><TD VALIGN=top><TT><B>$_</B></TT></TD>
  1974. <TD VALIGN=top>The default input and pattern-searching space.</TD></TR>
  1975. <TR><TD VALIGN=top><TT><B>$.</B></TT></TD>
  1976. <TD VALIGN=top>The current input line number of the last filehandle that was read.</TD></TR>
  1977. <TR><TD VALIGN=top><TT><B>$/</B></TT></TD>
  1978. <TD VALIGN=top>The input record separator, newline by default. May be multicharacter.</TD></TR>
  1979. <TR><TD VALIGN=top><TT><B>$,</B></TT></TD>
  1980. <TD VALIGN=top>The output field separator for the print operator.</TD></TR>
  1981. <TR><TD VALIGN=top><TT><B>$"</B></TT></TD>
  1982. <TD VALIGN=top>The separator that joins elements of arrays interpolated in strings.</TD></TR>
  1983. <TR><TD VALIGN=top><TT><B>$\</B></TT></TD>
  1984. <TD VALIGN=top>The output record separator for the print operator.</TD></TR>
  1985. <TR><TD VALIGN=top><TT><B>$#</B></TT></TD>
  1986. <TD VALIGN=top>The output format for printed numbers. Depreciated.</TD></TR>
  1987. <TR><TD VALIGN=top><TT><B>$*</B></TT></TD>
  1988. <TD VALIGN=top>Set to 1 to do multiline matching within strings.
  1989. Deprecated, see the <B>m</B> and <B>s</B> modifiers in section
  1990. <A HREF="#search">Search and Replace Functions</A>.</TD></TR>
  1991. <TR><TD VALIGN=top><TT><B>$?</B></TT></TD>
  1992. <TD VALIGN=top>The status returned by the last <TT><B>`</B></TT>...<TT><B>`</B></TT> command,
  1993. pipe <B>close</B> or <B>system</B> operator.</TD></TR>
  1994. <TR><TD VALIGN=top><TT><B>$]</B></TT></TD>
  1995. <TD VALIGN=top>The perl version number, e.g., <TT><B>5.001</TT></B>.</TD></TR>
  1996. <TR><TD VALIGN=top><TT><B>$[</B></TT></TD>
  1997. <TD VALIGN=top>The index of the first element in an array, and of the first character
  1998. in a substring. Default is 0. Depreciated.</TD></TR>
  1999. <TR><TD VALIGN=top><TT><B>$;</B></TT></TD>
  2000. <TD VALIGN=top>The subscript separator for multidimensional array emulation.
  2001. Default is "<TT><B>\034</B></TT>".</TD></TR>
  2002. <TR><TD VALIGN=top><TT><B>$!</B></TT></TD>
  2003. <TD VALIGN=top>If used in a numeric context, yields the current value of <B>errno</B>.
  2004. If used in a string context, yields the corresponding error string.</TD></TR>
  2005. <TR><TD VALIGN=top><TT><B>$@</B></TT></TD>
  2006. <TD VALIGN=top>The Perl error message from the last <B>eval</B> or <B>do</B> <FONT SIZE="-1">EXPR</FONT>
  2007. command.</TD></TR>
  2008. <TR><TD VALIGN=top><TT><B>$:</B></TT></TD>
  2009. <TD VALIGN=top>The set of characters after which a string may be broken to
  2010. fill continuation fields (starting with <TT><B>^</B></TT>) in a format.</TD></TR>
  2011. <TR><TD VALIGN=top><TT><B>$0</B></TT></TD>
  2012. <TD VALIGN=top>The name of the file containing the Perl script being executed.
  2013. May be assigned to.</TD></TR>
  2014. <TR><TD VALIGN=top><TT><B>$$</B></TT></TD>
  2015. <TD VALIGN=top>The process ID of the currently executing Perl program.
  2016. Altered (in the child process) by <B>fork</B>.</TD></TR>
  2017. <TR><TD VALIGN=top><TT><B>$&lt;</B></TT></TD>
  2018. <TD VALIGN=top>The real user ID of this process.</TD></TR>
  2019. <TR><TD VALIGN=top><TT><B>$&gt;</B></TT></TD>
  2020. <TD VALIGN=top>The effective user ID of this process.</TD></TR>
  2021. <TR><TD VALIGN=top><TT><B>$(</B></TT></TD>
  2022. <TD VALIGN=top>The real group ID of this process.</TD></TR>
  2023. <TR><TD VALIGN=top><TT><B>$)</B></TT></TD>
  2024. <TD VALIGN=top>The effective group ID of this process.</TD></TR>
  2025. <TR><TD VALIGN=top><TT><B>$^A</B></TT></TD>
  2026. <TD VALIGN=top>The accumulator for <B>formline</B> and <B>write</B> operations.</TD></TR>
  2027. <TR><TD VALIGN=top><TT><B>$^D</B></TT></TD>
  2028. <TD VALIGN=top>The debug flags as passed to perl using <TT><B>-D</B></TT>.</TD></TR>
  2029. <TR><TD VALIGN=top><TT><B>$^F</B></TT></TD>
  2030. <TD VALIGN=top>The highest system file descriptor, ordinarily 2.</TD></TR>
  2031. <TR><TD VALIGN=top><TT><B>$^I</B></TT></TD>
  2032. <TD VALIGN=top>In-place edit extension as passed to Perl using <TT><B>-i</B></TT>.</TD></TR>
  2033. <TR><TD VALIGN=top><TT><B>$^L</B></TT></TD>
  2034. <TD VALIGN=top>Formfeed character used in formats.</TD></TR>
  2035. <TR><TD VALIGN=top><TT><B>$^P</B></TT></TD>
  2036. <TD VALIGN=top>Internal debugging flag.</TD></TR>
  2037. <TR><TD VALIGN=top><TT><B>$^T</B></TT></TD>
  2038. <TD VALIGN=top>The time (as delivered by <B>time</B>) when the program started.
  2039. This value is used by the file test operators <TT><B>-M</B></TT>,
  2040. <TT><B>-A</B></TT> and <TT><B>-C</B></TT>.</TD></TR>
  2041. <TR><TD VALIGN=top><TT><B>$^W</B></TT></TD>
  2042. <TD VALIGN=top>The value if the <TT><B>-w</B></TT> option as passed to Perl.</TD></TR>
  2043. <TR><TD VALIGN=top><TT><B>$^X</B></TT></TD>
  2044. <TD VALIGN=top>The name by which the currently executing program was invoked.</TD></TR>
  2045. <TR><TD COLSPAN=2>&nbsp;</TD></TR>
  2046. <TR><TD VALIGN=top COLSPAN=2>The following variables are context dependent
  2047. and need not be localized:</TD></TR>
  2048. <TR><TD VALIGN=top><TT><B>$%</B></TT></TD>
  2049. <TD VALIGN=top>The current page number of the currently selected output channel.</TD></TR>
  2050. <TR><TD VALIGN=top><TT><B>$=</B></TT></TD>
  2051. <TD VALIGN=top>The page length of the current output channel. Default is 60 lines.</TD></TR>
  2052. <TR><TD VALIGN=top><TT><B>$-</B></TT></TD>
  2053. <TD VALIGN=top>The number of lines remaining on the page.</TD></TR>
  2054. <TR><TD VALIGN=top><TT><B>$~</B></TT></TD>
  2055. <TD VALIGN=top>The name of the current report format.</TD></TR>
  2056. <TR><TD VALIGN=top><TT><B>$^</B></TT></TD>
  2057. <TD VALIGN=top>The name of the current top-of-page format.</TD></TR>
  2058. <TR><TD VALIGN=top><TT><B>$|</B></TT></TD>
  2059. <TD VALIGN=top>If set to nonzero, forces a flush after every write or print on the
  2060. currently selected output channel. Default is 0.</TD></TR>
  2061. <TR><TD VALIGN=top><TT><B>$ARGV</B></TT></TD>
  2062. <TD VALIGN=top>The name of the current file when reading from <TT><B>&lt;&gt;</B></TT>.</TD></TR>
  2063. <TR><TD COLSPAN=2>&nbsp;</TD></TR>
  2064. <TR><TD VALIGN=top COLSPAN=2>The following variables are always local to the
  2065. current block:</TD></TR>
  2066. <TR><TD VALIGN=top><TT><B>$&amp;</B></TT></TD>
  2067. <TD VALIGN=top>The string matched by the last successful pattern match.</TD></TR>
  2068. <TR><TD VALIGN=top><TT><B>$`</B></TT></TD>
  2069. <TD VALIGN=top>The string preceding what was matched by the last successful match.</TD></TR>
  2070. <TR><TD VALIGN=top><TT><B>$'</B></TT></TD>
  2071. <TD VALIGN=top>The string following what was matched by the last successful match.</TD></TR>
  2072. <TR><TD VALIGN=top><TT><B>$+</B></TT></TD>
  2073. <TD VALIGN=top>The last bracket matched by the last search pattern.</TD></TR>
  2074. <TR><TD VALIGN=top><TT><B>$1</B></TT>...<TT><B>$9</B></TT>...&nbsp;&nbsp;</TD>
  2075. <TD VALIGN=top>Contain the subpatterns from the corresponding sets of parentheses in the
  2076. last pattern successfully matched. <TT><B>$10</B></TT>... and up are only available if the
  2077. match contained that many subpatterns.</TD></TR>
  2078. </TABLE>
  2079. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  2080. <!-- ----------------------------------------------------------------------------- -->
  2081. <A NAME="specialarrays"></A>
  2082. <H2>Special Arrays</H2>
  2083. <TABLE CELLSPACING=0 CELLPADDING=0>
  2084. <TR><TD VALIGN=top><TT><B>@ARGV</B></TT></TD>
  2085. <TD VALIGN=top>Contains the command-line arguments for the script (not including the
  2086. command name).</TD></TR>
  2087. <TR><TD VALIGN=top><TT><B>@EXPORT</B></TT></TD>
  2088. <TD VALIGN=top>Names the methods a package exports by default.</TD></TR>
  2089. <TR><TD VALIGN=top><TT><B>@EXPORT_OK&nbsp;</B></TT></TD>
  2090. <TD VALIGN=top>Names the methods a package can export upon explicit request.</TD></TR>
  2091. <TR><TD VALIGN=top><TT><B>@INC</B></TT></TD>
  2092. <TD VALIGN=top>Contains the list of places to look for Perl scripts to be evaluated by
  2093. the <B>do</B> <FONT SIZE="-1">FILENAME</FONT> and <B>require</B> commands.</TD></TR>
  2094. <TR><TD VALIGN=top><TT><B>@ISA</B></TT></TD>
  2095. <TD VALIGN=top>List of base classes of a package.</TD></TR>
  2096. <TR><TD VALIGN=top><TT><B>@_</B></TT></TD>
  2097. <TD VALIGN=top>Parameter array for subroutines. Also used by <B>split</B>
  2098. if not in array context.</TD></TR>
  2099. <TR><TD VALIGN=top><TT><B>%ENV</B></TT></TD>
  2100. <TD VALIGN=top>Contains the current environment.</TD></TR>
  2101. <TR><TD VALIGN=top><TT><B>%INC</B></TT></TD>
  2102. <TD VALIGN=top>List of files that have been included with <B>require</B> or <B>do</B>.</TD></TR>
  2103. <TR><TD VALIGN=top><TT><B>%OVERLOAD</B></TT></TD>
  2104. <TD VALIGN=top>Can be used to overload operators in a package.</TD></TR>
  2105. <TR><TD VALIGN=top><TT><B>%SIG</B></TT></TD>
  2106. <TD VALIGN=top>Used to set signal handlers for various signals.</TD></TR>
  2107. </TABLE>
  2108. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  2109. <!-- ----------------------------------------------------------------------------- -->
  2110. <A NAME="environment"></A>
  2111. <H2>Environment Variables</H2>
  2112. <P>Perl uses the following environment variables.</P>
  2113. <TABLE CELLSPACING=0 CELLPADDING=0>
  2114. <TR><TD VALIGN=top><TT><B>HOME</B></TT></TD>
  2115. <TD VALIGN=top>Used if <B>chdir</B> has no argument.</TD></TR>
  2116. <TR><TD VALIGN=top><TT><B>LOGDIR</B></TT></TD>
  2117. <TD VALIGN=top>Used if <B>chdir</B> has no argument and <TT><B>HOME</TT></B> is not set.</TD></TR>
  2118. <TR><TD VALIGN=top><TT><B>PATH</B></TT></TD>
  2119. <TD VALIGN=top>Used in executing subprocesses, and in finding the Perl script if <TT><B>-S</TT></B>
  2120. is used.</TD></TR>
  2121. <TR><TD VALIGN=top><TT><B>PERL5LIB&nbsp;</B></TT></TD>
  2122. <TD VALIGN=top>A colon-separated list of directories to look in for Perl library files
  2123. before looking in the standard library and the current directory.</TD></TR>
  2124. <TR><TD VALIGN=top><TT><B>PERL5DB</B></TT></TD>
  2125. <TD VALIGN=top>The command to get the debugger code.
  2126. <BR>Defaults to <TT><B>BEGIN { require 'perl5db.pl' }</TT></B>.</TD></TR>
  2127. <TR><TD VALIGN=top><TT><B>PERLLIB</B></TT></TD>
  2128. <TD VALIGN=top>Used instead of <TT><B>PERL5LIB</TT></B> if the latter is not defined.</TD></TR>
  2129. </TABLE>
  2130. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  2131. <!-- ----------------------------------------------------------------------------- -->
  2132. <A NAME="debugger"></A>
  2133. <H2>The Perl Debugger</H2>
  2134. The Perl symbolic debugger is invoked with <TT><B>perl -d</B></TT>.
  2135. <TABLE CELLSPACING=0 CELLPADDING=0>
  2136. <TR><TD VALIGN=top><TT><B>h</B></TT></TD>
  2137. <TD VALIGN=top>Prints out a help message.</TD></TR>
  2138. <TR><TD VALIGN=top><TT><B>T</B></TT></TD>
  2139. <TD VALIGN=top>Prints a stack trace.</TD></TR>
  2140. <TR><TD VALIGN=top><TT><B>s</B></TT></TD>
  2141. <TD VALIGN=top>Single steps.</TD></TR>
  2142. <TR><TD VALIGN=top><TT><B>n</B></TT></TD>
  2143. <TD VALIGN=top>Single steps around subroutine call.</TD></TR>
  2144. <TR><TD VALIGN=top><FONT SIZE="-1">RETURN key</FONT></TD>
  2145. <TD VALIGN=top>Repeats last <TT><B>s</B></TT> or <TT><B>n</B></TT>.</TD></TR>
  2146. <TR><TD VALIGN=top><TT><B>r</B></TT></TD>
  2147. <TD VALIGN=top>Returns form the current subroutine.</TD></TR>
  2148. <TR><TD VALIGN=top><TT><B>c</B></TT> [ <FONT SIZE="-1">LINE</FONT> ]</TD>
  2149. <TD VALIGN=top>Continues (until <FONT SIZE="-1">LINE</FONT>,
  2150. or another breakpoint, or exit).</TD></TR>
  2151. <TR><TD VALIGN=top><TT><B>p</B></TT> <FONT SIZE="-1">EXPR</FONT></TD>
  2152. <TD VALIGN=top>Prints <FONT SIZE="-1">EXPR</FONT>.</TD></TR>
  2153. <TR><TD VALIGN=top><TT><B>l</B></TT> [ <FONT SIZE="-1">RANGE</FONT> ]</TD>
  2154. <TD VALIGN=top>Lists a range of lines.
  2155. <FONT SIZE="-1">RANGE</FONT> may be a number, start-end,
  2156. start+amount, or a subroutine name. If <FONT SIZE="-1">RANGE</FONT> is omitted,
  2157. lists next window.</TD></TR>
  2158. <TR><TD VALIGN=top><TT><B>w</B></TT></TD>
  2159. <TD VALIGN=top>Lists window around current line.</TD></TR>
  2160. <TR><TD VALIGN=top><TT><B>-</B></TT></TD>
  2161. <TD VALIGN=top>Lists previous window.</TD></TR>
  2162. <TR><TD VALIGN=top><TT><B>f</B></TT> <FONT SIZE="-1">FILE</FONT></TD>
  2163. <TD VALIGN=top>Switches to <FONT SIZE="-1">FILE</FONT> and starts listing it.</TD></TR>
  2164. <TR><TD VALIGN=top><TT><B>l</B></TT> <FONT SIZE="-1">SUB</FONT></TD>
  2165. <TD VALIGN=top>Lists the named subroutine.</TD></TR>
  2166. <TR><TD VALIGN=top><TT><B>S</B></TT></TD>
  2167. <TD VALIGN=top>List the names of all subroutines.</TD></TR>
  2168. <TR><TD VALIGN=top><TT><B>/</B></TT><FONT SIZE="-1">PATTERN</FONT><TT><B>/</B></TT></TD>
  2169. <TD VALIGN=top>Searches forward for <FONT SIZE="-1">PATTERN</FONT>.</TD></TR>
  2170. <TR><TD VALIGN=top><TT><B>?</B></TT><FONT SIZE="-1">PATTERN</FONT><TT><B>?</B></TT></TD>
  2171. <TD VALIGN=top>Searches backward for <FONT SIZE="-1">PATTERN</FONT>.</TD></TR>
  2172. <TR><TD VALIGN=top NOWRAP><TT><B>b</B></TT> [ <FONT SIZE="-1">LINE</FONT> [ <FONT SIZE="-1">CONDITION</FONT> ] ]&nbsp;&nbsp;</TD>
  2173. <TD VALIGN=top>Sets breakpoint at <FONT SIZE="-1">LINE</FONT>; default is the current line.</TD></TR>
  2174. <TR><TD VALIGN=top><TT><B>b</B></TT> <FONT SIZE="-1">SUB</FONT> [ <FONT SIZE="-1">CONDITION</FONT> ]</TD>
  2175. <TD VALIGN=top>Sets breakpoint at the subroutine.</TD></TR>
  2176. <TR><TD VALIGN=top><TT><B>d</B></TT> [ <FONT SIZE="-1">LINE</FONT> ]</TD>
  2177. <TD VALIGN=top>Deletes breakpoint at the given line.</TD></TR>
  2178. <TR><TD VALIGN=top><TT><B>D</B></TT></TD>
  2179. <TD VALIGN=top>Deletes all breakpoints.</TD></TR>
  2180. <TR><TD VALIGN=top><TT><B>L</B></TT></TD>
  2181. <TD VALIGN=top>Lists lines that have breakpoints or actions.</TD></TR>
  2182. <TR><TD VALIGN=top><TT><B>a</B></TT> <FONT SIZE="-1">LINE COMMAND</FONT></TD>
  2183. <TD VALIGN=top>Sets an action for line.</TD></TR>
  2184. <TR><TD VALIGN=top><TT><B>A</B></TT></TD>
  2185. <TD VALIGN=top>Deletes all line actions.</TD></TR>
  2186. <TR><TD VALIGN=top><TT><B>&lt;</B></TT> <FONT SIZE="-1">COMMAND</FONT></TD>
  2187. <TD VALIGN=top>Sets an action to be executed before every debugger prompt.</TD></TR>
  2188. <TR><TD VALIGN=top><TT><B>&gt;</B></TT> <FONT SIZE="-1">COMMAND</FONT></TD>
  2189. <TD VALIGN=top>Sets an action to be executed before every
  2190. <TT><B>s</B></TT>, <TT><B>c</B></TT> or <TT><B>n</B></TT> command.</TD></TR>
  2191. <TR><TD VALIGN=top NOWRAP><TT><B>V</B></TT> [ <FONT SIZE="-1">PACKAGE</FONT> [ <FONT SIZE="-1">VARS</FONT> ] ]&nbsp;&nbsp;</TD>
  2192. <TD VALIGN=top>Lists all variables in a package. Default package is <TT><B>main</TT></B>.</TD></TR>
  2193. <TR><TD VALIGN=top><TT><B>X</B></TT> [ <FONT SIZE="-1">VARS</FONT> ]</TD>
  2194. <TD VALIGN=top>Like <TT><B>V</B></TT>, but assumes current package.</TD></TR>
  2195. <TR><TD VALIGN=top><TT><B>!</B></TT> [ [<TT><B>-</TT></B>]<FONT SIZE="-1">NUMBER</FONT> ]</TD>
  2196. <TD VALIGN=top>Re-executes a command. Default is the previous command.</TD></TR>
  2197. <TR><TD VALIGN=top><TT><B>H</B></TT> [ -<FONT SIZE="-1">NUMBER</FONT> ]</TD>
  2198. <TD VALIGN=top>Displays the last <TT><B>-</TT></B><FONT SIZE="-1">NUMBER</FONT>
  2199. commands of more than one letter.</TD></TR>
  2200. <TR><TD VALIGN=top><TT><B>t</B></TT></TD>
  2201. <TD VALIGN=top>Toggles trace mode.</TD></TR>
  2202. <TR><TD VALIGN=top><TT><B>=</B></TT> [ <FONT SIZE="-1">ALIAS VALUE</FONT> ]</TD>
  2203. <TD VALIGN=top>Sets alias, or lists current aliases.</TD></TR>
  2204. <TR><TD VALIGN=top><TT><B>q</B></TT></TD>
  2205. <TD VALIGN=top>Quits. You may also use your <FONT SIZE="-1">EOF key</FONT> character.</TD></TR>
  2206. <TR><TD VALIGN=top><FONT SIZE="-1">COMMAND</FONT></TD>
  2207. <TD VALIGN=top>Executes <FONT SIZE="-1">COMMAND</FONT> as a Perl statement.</TD></TR>
  2208. </TABLE>
  2209. <H4 ALIGN=center>Back to <A HREF="#contents">Contents</A> or <A HREF="#index">Index</A></H4>
  2210. <!-- ----------------------------------------------------------------------------- -->
  2211. <HR NOSHADE SIZE=4>
  2212. <H3>Other Summaries and Demos</H3>
  2213. <UL>
  2214. <LI>See my <A HREF="http://www.pcnet.com/~rhswain/">home page</A> for other summaries and demos:
  2215. APL, REXX, XEDIT, Perl, HTML, RGB Colors, HTTP Cookies, Email Forms,
  2216. CGI Environment Variables, Server Side Includes, etc...
  2217. </UL>
  2218. <HR SIZE=1>
  2219. <CENTER>
  2220. <ADDRESS>
  2221. Text copyright &copy; 1996 Johan Vromans<BR>
  2222. HTML copyright &copy; 1996-1997 Rex Swain<BR>
  2223. Email <A HREF="mailto:[email protected]">[email protected]</A>,
  2224. Web <A HREF="http://www.pcnet.com/~rhswain/">http://www.pcnet.com/~rhswain</A><BR>
  2225. Permission granted to distribute unmodified copies<BR>
  2226. Reports of errors or omissions appreciated
  2227. </ADDRESS>
  2228. </CENTER>
  2229. </BODY>
  2230. </HTML>