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

📄 ch24.htm

📁 prrl 5 programs codes in the book
💻 HTM
📖 第 1 页 / 共 4 页
字号:
Interpreter</FONT></A></H2>

<P>

An interpreter executes your program without first creating an

executable file. It interprets your program into the language

of the CPU, on-the-fly. Compilers and interpreters do a lot of

the same work. However, siNCe interpreters can't create executable

files, 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 more

processes need to communicate. The communication can take place

using 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 the

index 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 you

need to return. Typically, you label the outer loop in a nested

series of loops so that you can jump out of the inner loops if

needed.

<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 represented

by \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. Libraries

are loaded into your program using the <TT>require</TT>

compiler directive. <A HREF="ch15.htm" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/ch15.htm" >Chapter 15</A>, &quot;Perl Modules,&quot; talks

a 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; in

your source code. There are four types of Perl literals: Number,

Strings, Arrays, and Hashes. <A HREF="ch2.htm" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/ch2.htm" >Chapter 2</A> &quot;Numeric and String

Literals,&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" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/ch7.htm" >Chapter 7</A>

&quot;Control Statements,&quot; discusses the different types

of 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 meaning

inside regular expressions. <A HREF="ch10.htm" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/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-such

as a library. However, modules are a bit more complex. Modules

can control which fuNCtion and variable names get exported from

the module namespace into the main namespace. See <A HREF="ch15.htm" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/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 can

use the same variable name for different data types. For example,

<TT>$foo</TT>, <TT>@foo</TT>,

and <TT>%foo</TT> are different data

types with the same name. You can create your own namespace with

the <TT>Package</TT> keyword. See

<A HREF="ch14.htm" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/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 actions

to 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 perform

their tasks. The outside information is called a parameter. For

example, the <TT>print()</TT> fuNCtion

needs 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 means

that a child class can redefine a method already defined in the

parent class. <A HREF="ch14.htm" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/ch14.htm" >Chapter 14</A>, &quot;What Are Objects?&quot; discusses

polymorphism.

<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 addition

to the server address, each socket also needs a port number. The

port number is added to the end of the server address to create

a full address. For example, www.locked.com:80 is a full Internet

address 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. This

priority or precedeNCe level tells Perl which operators should

be evaluated first. <A HREF="ch4.htm" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/ch4.htm" >Chapter 4</A> &quot;Operators,&quot; lists all

of 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 basically

the same thing-a set of statements that are grouped together for

a common cause. If you like to be picky, fuNCtions are routines

that return values while subroutines don't return values. Procedure

is 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. The

Internet has a plethora of protocols that you can use. See Chapter

22, &quot;Internet Resources,&quot; for information about how

to 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 location

that holds some type of data. See <A HREF="ch8.htm" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/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" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/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. The

return value is the value of the last executed statement or you

can use the <TT>return()</TT> to explicitly

state it. You may always choose to ignore the return value by

not 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-time

errors are logic errors and therefore usually harder to track

down 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" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/ch3.htm" >Chapter 3</A> &quot;Variables,&quot; shows you how scalars can be

used.

<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 therefore

are said to have a global visibility or scope. You can create

variables that are local to a particular fuNCtion or block of

code 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 second

operand 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 normal

flow of execution. If you don't have a signal handler fuNCtion

defined, default internal fuNCtions will be called. See Chapter

13, &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 create

a connection to another computer using the socket fuNCtions. Then,

you can send and receive information over the sockets. See Chapter

18, &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 a

stack of potato chips in a Pringles can. Only the top chip is

accessible. And, therefore, two operations are possible: add a

chip or remove a chip. A stack works exactly the same way. You

can push a new item onto the stack or you can pop an item off

the 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. The

semicolon 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 predefined

filehandles 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 output

in any way. This is my preferred mode of operation, by the way.

Text mode-only available on some operating systems like Windows

95 and Windows NT-will convert newline/carriage return character

pairs into a single newline. It will also interpret any byte that

has 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. It

is 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 computer

programs. Typically, variables have a name and a data type. Perl

variables can be scalars, arrays, or hashes. Every variable has

a life-cycle. It gets created, used, and is then destroyed. Regular

Perl variables are created when they are initialized and destroyed

when the program ends. The <TT>my()</TT>

fuNCtion can create a variable that only exists inside a fuNCtion

or 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. You

can use the <TT>\s</TT> symbolic character

class in patterns to match whitespace characters.

<HR>



<CENTER><P><A HREF="ch23.htm" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/ch23.htm"><IMG SRC="pc.gif" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/pc.gif" BORDER=0 HEIGHT=88 WIDTH=140></A>

<A HREF="#CONTENTS"><IMG SRC="cc.gif" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/cc.gif" BORDER=0 HEIGHT=88 WIDTH=140></A>

<A HREF="index-1.htm" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/index-1.htm"><IMG SRC="hb.gif" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/hb.gif" BORDER=0 HEIGHT=88 WIDTH=140></A>

<A HREF="ch25.htm" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/ch25.htm"><IMG SRC="nc.gif" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/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 + -