⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch24.htm

📁 this is a book on pearl , simple example with explanation is given here. it could be beneficial for
💻 HTM
📖 第 1 页 / 共 4 页
字号:
Interpreter</FONT></A></H2><P>An interpreter executes your program without first creating anexecutable file. It interprets your program into the languageof the CPU, on-the-fly. Compilers and interpreters do a lot ofthe same work. However, siNCe interpreters can't create executablefiles, the source code must always be available to users.<BLOCKQUOTE>See also <I>Compiler</I>.</BLOCKQUOTE><H2><A NAME="InterprocessCommunication"><FONT SIZE=5 COLOR=#FF0000>Inter-process Communication</FONT></A></H2><P>You use inter-process communication, or IPC, when two or moreprocesses need to communicate. The communication can take placeusing databases, shared memory, semaphores, or sockets.<H2><A NAME="IO"><FONT SIZE=5 COLOR=#FF0000>I/O</FONT></A></H2><P>I/O is an abbreviation for Input/Output.<H2><A NAME="IPC"><FONT SIZE=5 COLOR=#FF0000>IPC</FONT></A></H2><BLOCKQUOTE>See <I>Inter-process Communication</I>.</BLOCKQUOTE><H2><A NAME="KeyValuePair"><FONT SIZE=5 COLOR=#FF0000>Key-Value Pair</FONT></A></H2><P>Each entry in a hash is a key-value pair. The key is used as theindex to retrieve the value.<H2><A NAME="Label"><FONT SIZE=5 COLOR=#FF0000>Label</FONT></A></H2><P>You use labels to mark locations in your program to which youneed to return. Typically, you label the outer loop in a nestedseries of loops so that you can jump out of the inner loops ifneeded.<H2><A NAME="LF"><FONT SIZE=5 COLOR=#FF0000>LF</FONT></A></H2><P>LF is the abbreviation for linefeed or newline. An LF is representedby \n in strings. The linefeed can also be referred to as Ctrl+M,^M, 0x0d, or as an ASCII value of 13.<BLOCKQUOTE>See also <I>ASCII</I> and <I>Control Characters</I>.</BLOCKQUOTE><H2><A NAME="Library"><FONT SIZE=5 COLOR=#FF0000>Library</FONT></A></H2><P>A library is a file that groups related fuNCtions together. Librariesare loaded into your program using the <TT>require</TT>compiler directive. <A HREF="ch15.htm" >Chapter 15</A>, &quot;Perl Modules,&quot; talksa little bit about libraries.<H2><A NAME="List"><FONT SIZE=5 COLOR=#FF0000>List</FONT></A></H2><P>See <I>Array</I>.<H2><A NAME="Literal"><FONT SIZE=5 COLOR=#FF0000>Literal</FONT></A></H2><P>A literal is a value that is represented &quot;as is&quot; inyour source code. There are four types of Perl literals: Number,Strings, Arrays, and Hashes. <A HREF="ch2.htm" >Chapter 2</A> &quot;Numeric and StringLiterals,&quot; shows many examples of literals.<H2><A NAME="Loop"><FONT SIZE=5 COLOR=#FF0000>Loop</FONT></A></H2><P>A loop is a series of statements that are executed more than oNCe.Each loop has a control mechanism to stop looping. <A HREF="ch7.htm" >Chapter 7</A>&quot;Control Statements,&quot; discusses the different typesof looping and controls that are used.<BLOCKQUOTE>See also <I>Endless Loop</I>.</BLOCKQUOTE><H2><A NAME="MetaCharacters"><FONT SIZE=5 COLOR=#FF0000>Meta Characters</FONT></A></H2><P>Meta characters are characters that have more than one meaninginside regular expressions. <A HREF="ch10.htm" >Chapter 10</A>, &quot;Regular Expressions,&quot;has an in-depth discussion of meta-characters.<BLOCKQUOTE>See also <I>Regular Expressions</I>.</BLOCKQUOTE><H2><A NAME="Module"><FONT SIZE=5 COLOR=#FF0000>Module</FONT></A></H2><P>A module is a file that holds a related group of fuNCtions-suchas a library. However, modules are a bit more complex. Modulescan control which fuNCtion and variable names get exported fromthe module namespace into the main namespace. See <A HREF="ch15.htm" >Chapter 15</A>,&quot;Perl Modules,&quot; for more information.<H2><A NAME="Namespace"><FONT SIZE=5 COLOR=#FF0000>Namespace</FONT></A></H2><P>Namespaces are used to segregate fuNCtion and variable names.Each data type has its own namespace. This means that you canuse the same variable name for different data types. For example,<TT>$foo</TT>, <TT>@foo</TT>,and <TT>%foo</TT> are different datatypes with the same name. You can create your own namespace withthe <TT>Package</TT> keyword. See<A HREF="ch14.htm" >Chapter 14</A>, &quot;What Are Objects?&quot; for more information.<H2><A NAME="Object"><FONT SIZE=5 COLOR=#FF0000>Object</FONT></A></H2><BLOCKQUOTE>See <I>Class</I>.</BLOCKQUOTE><H2><A NAME="Octal"><FONT SIZE=5 COLOR=#FF0000>Octal</FONT></A></H2><P>Octal refers to numbers using base 8.<H2><A NAME="Operator"><FONT SIZE=5 COLOR=#FF0000>Operator</FONT></A></H2><P>The operators in a computer language tell the computer what actionsto perform. For example, the plus sign (+) is an operator.<H2><A NAME="Parameter"><FONT SIZE=5 COLOR=#FF0000>Parameter</FONT></A></H2><P>Some fuNCtions need outside information before they can performtheir tasks. The outside information is called a parameter. Forexample, the <TT>print()</TT> fuNCtionneeds to know what it should print and where.<H2><A NAME="Polymorphism"><FONT SIZE=5 COLOR=#FF0000>Polymorphism</FONT></A></H2><P>Polymorphism is a term from the object-oriented world. It meansthat a child class can redefine a method already defined in theparent class. <A HREF="ch14.htm" >Chapter 14</A>, &quot;What Are Objects?&quot; discussespolymorphism.<H2><A NAME="Port"><FONT SIZE=5 COLOR=#FF0000>Port</FONT></A></H2><P>A port is the address of a socket on an Internet server. In additionto the server address, each socket also needs a port number. Theport number is added to the end of the server address to createa full address. For example, www.locked.com:80 is a full Internetaddress that specifies a port number of 80.<H2><A NAME="PrecedeNCe"><FONT SIZE=5 COLOR=#FF0000>PrecedeNCe</FONT></A></H2><P>Every Perl operator and fuNCtion has an associated priority. Thispriority or precedeNCe level tells Perl which operators shouldbe evaluated first. <A HREF="ch4.htm" >Chapter 4</A> &quot;Operators,&quot; lists allof the operators and their priorities.<H2><A NAME="Procedure"><FONT SIZE=5 COLOR=#FF0000>Procedure</FONT></A></H2><P>FuNCtions, procedures, routines, and subroutines are all basicallythe same thing-a set of statements that are grouped together fora common cause. If you like to be picky, fuNCtions are routinesthat return values while subroutines don't return values. Procedureis the generic name used to refer to both fuNCtions and subroutines.<H2><A NAME="Protocol"><FONT SIZE=5 COLOR=#FF0000>Protocol</FONT></A></H2><P>A protocol is a set of agreed-upon commands and responses. TheInternet has a plethora of protocols that you can use. See Chapter22, &quot;Internet Resources,&quot; for information about howto find more information.<H2><A NAME="Range"><FONT SIZE=5 COLOR=#FF0000>Range</FONT></A></H2><BLOCKQUOTE>See <I>Array Range</I>.</BLOCKQUOTE><H2><A NAME="Record"><FONT SIZE=5 COLOR=#FF0000>Record</FONT></A></H2><BLOCKQUOTE>See <I>Database</I>.</BLOCKQUOTE><H2><A NAME="RefereNCe"><FONT SIZE=5 COLOR=#FF0000>RefereNCe</FONT></A></H2><P>A refereNCe is a scalar value that points to a memory locationthat holds some type of data. See <A HREF="ch8.htm" >Chapter 8</A> &quot;RefereNCes,&quot;for more information.<H2><A NAME="RegularExpression"><FONT SIZE=5 COLOR=#FF0000>Regular Expression</FONT></A></H2><P>A Regular Expression is used to find patterns in strings. See<A HREF="ch10.htm" >Chapter 10</A>, &quot;Regular Expressions,&quot; for more information.<H2><A NAME="ReturnValue"><FONT SIZE=5 COLOR=#FF0000>Return Value</FONT></A></H2><P>All Perl fuNCtions return a value when they are finished. Thereturn value is the value of the last executed statement or youcan use the <TT>return()</TT> to explicitlystate it. You may always choose to ignore the return value bynot assigning the fuNCtion call to a variable.<H2><A NAME="RunTimeError"><FONT SIZE=5 COLOR=#FF0000>Run-Time Error</FONT></A></H2><P>Run-time errors happen while your program is executing. Run-timeerrors are logic errors and therefore usually harder to trackdown than compile-time errors.<H2><A NAME="Scalar"><FONT SIZE=5 COLOR=#FF0000>Scalar</FONT></A></H2><P>A scalar variable can hold one string or number value at a time.<A HREF="ch3.htm" >Chapter 3</A> &quot;Variables,&quot; shows you how scalars can beused.<H2><A NAME="ScalarContext"><FONT SIZE=5 COLOR=#FF0000>Scalar Context</FONT></A></H2><BLOCKQUOTE>See <I>Context (Array &amp; Scalar)</I>.</BLOCKQUOTE><H2><A NAME="Scope"><FONT SIZE=5 COLOR=#FF0000>Scope</FONT></A></H2><P>Normal Perl variables can be used by any fuNCtion and thereforeare said to have a global visibility or scope. You can createvariables that are local to a particular fuNCtion or block ofcode with the <TT>my()</TT> fuNCtion.These variables have a local scope.<H2><A NAME="ShortCircuitOperators"><FONT SIZE=5 COLOR=#FF0000>Short-Circuit Operators</FONT></A></H2><P>The <TT>&amp;&amp;</TT> and <TT>||</TT>operators are considered short-circuit operators because the secondoperand might not be evaluated. For example, in the statement<TT>0 &amp;&amp; die();</TT> the <TT>die()</TT>fuNCtion will not be executed. However, in the statement <TT>0|| die();</TT> the <TT>die()</TT>fuNCtion will be executed.<H2><A NAME="Signals"><FONT SIZE=5 COLOR=#FF0000>Signals</FONT></A></H2><P>A signal is a message sent to your program by the operating system.When a signal is received by your program, it interrupts the normalflow of execution. If you don't have a signal handler fuNCtiondefined, default internal fuNCtions will be called. See Chapter13, &quot;Handling Errors and Signals,&quot; for more information.<H2><A NAME="Slice"><FONT SIZE=5 COLOR=#FF0000>Slice</FONT></A></H2><BLOCKQUOTE>See <I>Array Slice</I>.</BLOCKQUOTE><H2><A NAME="Socket"><FONT SIZE=5 COLOR=#FF0000>Socket</FONT></A></H2><P>A socket is the end link of a connection between two computers.The first step to using any of the Internet protocols is to createa connection to another computer using the socket fuNCtions. Then,you can send and receive information over the sockets. See Chapter18, &quot;Using Internet Protocols,&quot; for more information.<H2><A NAME="Splice"><FONT SIZE=5 COLOR=#FF0000>Splice</FONT></A></H2><BLOCKQUOTE>See <I>Array Splice</I>.</BLOCKQUOTE><H2><A NAME="Stack"><FONT SIZE=5 COLOR=#FF0000>Stack</FONT></A></H2><P>A stack is a data structure that has the same properties as astack of potato chips in a Pringles can. Only the top chip isaccessible. And, therefore, two operations are possible: add achip or remove a chip. A stack works exactly the same way. Youcan push a new item onto the stack or you can pop an item offthe stack.<H2><A NAME="Statement"><FONT SIZE=5 COLOR=#FF0000>Statement</FONT></A></H2><P>A statement is an expression with a semicolon at the end. Thesemicolon transforms an expression into an executable statement.<H2><A NAME="STDERRSTDINandSTDOUT"><FONT SIZE=5 COLOR=#FF0000>STDERR, STDIN, and STDOUT</FONT></A></H2><P><TT>STDERR</TT>, <TT>STDIN</TT>,and <TT>STDOUT</TT> are predefinedfilehandles that every program can use. You use <TT>STDERR</TT>to display error messages, usually on the computer's monitor.You use <TT>STDIN</TT> to get input,usually from the keyboard. And you use <TT>STDOUT</TT>to display messages, usually on the computer's monitor.<H2><A NAME="Subroutine"><FONT SIZE=5 COLOR=#FF0000>Subroutine</FONT></A></H2><BLOCKQUOTE>See <I>Procedure</I>.</BLOCKQUOTE><H2><A NAME="TextMode"><FONT SIZE=5 COLOR=#FF0000>Text Mode</FONT></A></H2><P>When using files, you can use either binary mode or text mode.Binary mode means that Perl will not change your input or outputin any way. This is my preferred mode of operation, by the way.Text mode-only available on some operating systems like Windows95 and Windows NT-will convert newline/carriage return characterpairs into a single newline. It will also interpret any byte thathas a value of 26 as the end-of-file marker.<H2><A NAME="UndefinedValue"><FONT SIZE=5 COLOR=#FF0000>Undefined Value</FONT></A></H2><P>The undefined value (<TT>undef</TT>)can be returned by fuNCtions to indicate an error condition. Itis also the value returned when a nonexistent hash entry is accessed.<H2><A NAME="Variable"><FONT SIZE=5 COLOR=#FF0000>Variable</FONT></A></H2><P>A variable is a changeable piece of information used in computerprograms. Typically, variables have a name and a data type. Perlvariables can be scalars, arrays, or hashes. Every variable hasa life-cycle. It gets created, used, and is then destroyed. RegularPerl variables are created when they are initialized and destroyedwhen the program ends. The <TT>my()</TT>fuNCtion can create a variable that only exists inside a fuNCtionor code block.<H2><A NAME="Whitespace"><FONT SIZE=5 COLOR=#FF0000>Whitespace</FONT></A></H2><P>Whitespace is a term that refers to space, tab, and newline characters.These characters create white space on a page when printed. Youcan use the <TT>\s</TT> symbolic characterclass in patterns to match whitespace characters.<HR><CENTER><P><A HREF="ch23.htm"><IMG SRC="pc.gif" BORDER=0 HEIGHT=88 WIDTH=140></A><A HREF="#CONTENTS"><IMG SRC="cc.gif" BORDER=0 HEIGHT=88 WIDTH=140></A><A HREF="index.htm"><IMG SRC="hb.gif" BORDER=0 HEIGHT=88 WIDTH=140></A><A HREF="ch25.htm"><IMG SRC="nc.gif" BORDER=0 HEIGHT=88 WIDTH=140></A><HR WIDTH="100%"></P></CENTER></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -