查看單個文章
舊 2004-05-20, 11:44 AM   #3 (permalink)
mic64
註冊會員
 
mic64 的頭像
榮譽勳章
UID - 582
在線等級: 級別:16 | 在線時長:330小時 | 升級還需:27小時級別:16 | 在線時長:330小時 | 升級還需:27小時級別:16 | 在線時長:330小時 | 升級還需:27小時級別:16 | 在線時長:330小時 | 升級還需:27小時級別:16 | 在線時長:330小時 | 升級還需:27小時級別:16 | 在線時長:330小時 | 升級還需:27小時
註冊日期: 2002-12-06
VIP期限: 2007-04
住址: MIB總部
文章: 412
精華: 0
現金: 499 金幣
資產: 499 金幣
預設

2. The Gory Details
Contents:
Lexical Texture
Built-in Data Types
Terms
Pattern Matching
Operators
Statements and Declarations
Subroutines
Formats
Special Variables



This chapter describes in detail the syntax and semantics of a Perl program. Individual Perl functions are described in Chapter 3, Functions, and certain specialized topics such as References and Objects are deferred to later chapters.

For the most part, this chapter is organized from small to large. That is, we take a bottom-up approach. The disadvantage is that you don't necessarily get the Big Picture before getting lost in a welter of details. But the advantage is that you can understand the examples as we go along. (If you're a top-down person, just turn the book over and read the chapter backward.)

2.1 Lexical Texture
Perl is, for the most part, a free-form language. The main exceptions to this are format declarations and quoted strings, because these are in some senses literals. Comments are indicated by the # character and extend to the end of the line.

Perl is defined in terms of the ASCII character set. However, string literals may contain characters outside of the ASCII character set, and the delimiters you choose for various quoting mechanisms may be any non-alphanumeric, non-whitespace character.

Whitespace is required only between tokens that would otherwise be confused as a single token. All whitespace is equivalent for this purpose. A comment counts as whitespace. Newlines are distinguished from spaces only within quoted strings, and in formats and certain line-oriented forms of quoting.

One other lexical oddity is that if a line begins with = in a place where a statement would be legal, Perl ignores everything from that line down to the next line that says =cut. The ignored text is assumed to be POD, or plain old documentation. (The Perl distribution has programs that will turn POD commentary into manpages, LaTeX, or HTML documents.)
mic64 目前離線  
送花文章: 0, 收花文章: 21 篇, 收花: 61 次