• Aucun résultat trouvé

about the cover illustration

Dans le document Minimal Perl (Page 30-34)

The figure on the cover of Minimal Perl is an “Albanian.” The illustration is taken from a collection of costumes of the Ottoman Empire published on January 1, 1802, by Wil-liam Miller of Old Bond Street, London. The title page is missing from the collection and we have been unable to track it down to date. The book’s table of contents identifies the figures in both English and French, and each illustration bears the names of two art-ists who worked on it, both of whom would no doubt be surprised to find their art grac-ing the front cover of a computer programmgrac-ing book...two hundred years later.

The collection was purchased by a Manning editor at an antiquarian flea market in the “Garage” on West 26th Street in Manhattan. The seller was an American based in Ankara, Turkey, and the transaction took place just as he was packing up his stand for the day. The Manning editor did not have on his person the substantial amount of cash that was required for the purchase and a credit card and check were both politely turned down. With the seller flying back to Ankara that evening the situation was getting hopeless. What was the solution? It turned out to be nothing more than an old-fashioned verbal agreement sealed with a handshake. The seller simply pro-posed that the money be transferred to him by wire and the editor walked out with the bank information on a piece of paper and the portfolio of images under his arm.

Needless to say, we transferred the funds the next day, and we remain grateful and impressed by this unknown person's trust in one of us. It recalls something that might have happened a long time ago.

The pictures from the Ottoman collection, like the other illustrations that appear on our covers, bring to life the richness and variety of dress customs of two centuries ago. They recall the sense of isolation and distance of that period—and of every other historic period except our own hyperkinetic present.

Dress codes have changed since then and the diversity by region, so rich at the time, has faded away. It is now often hard to tell the inhabitant of one continent from another. Perhaps, trying to view it optimistically, we have traded a cultural and visual diversity for a more varied personal life. Or a more varied and interesting intellectual and technical life.

We at Manning celebrate the inventiveness, the initiative, and, yes, the fun of the computer business with book covers based on the rich diversity of regional life of two centuries ago‚ brought back to life by the pictures from this collection.

tables

Chapter 1

1.1 Forehead markings for the Perl dialects of Perlistan . . . 6 Chapter 2

2.1 Effects of Perl’s most essential invocation options . . . 17 2.2 The data and record-number variables . . . 24 2.3 Employing user-defined scalar variables in the Shell and Perl. . . 26 2.4 Comparison of Shell and Perl scripting techniques . . . 29 2.5 Using switch variables . . . 33 2.6 Shell and Perl techniques for writing messages to STDOUT and STDERR . . . 36 2.7 Special variables for I/O operations . . . 42 2.8 Special variables for formatting output . . . 43 2.9 Standard option clusters for Perl commands and scripts . . . 45

Chapter 3

3.1 String escapes for representing control characters. . . 56 3.2 Fundamental capabilities of greppers and Perl . . . 58 3.3 Matching operator syntax . . . 60 3.4 Essential syntax for regular expression . . . 63 3.5 Compact character-class shortcuts . . . 67 3.6 Matching operator examples . . . 69 3.7 Matching modifiers . . . 69 3.8 Metacharacters for alternation, grouping, match capturing, and match

referencing in greppers and Perl. . . 71 3.9 Quantifier metacharacters . . . 73 3.10 Examples of matching across lines . . . 78 3.11 Patterns for the shortest and longest sequences of anything or something . . . 78 3.12 Unix and Perl commands for common grepping activities . . . 87

Chapter 4

4.1 Text-modification capabilities of sed and Perl . . . 91 4.2 Substitution modifiers . . . 95 4.3 Substitution operator syntax . . . 95 4.4 Substitution operator examples . . . 96

4.5 String modifiers for case conversion . . . 113 4.6 sed and Perl commands for common editing activities . . . 119

Chapter 5

5.1 Differences in pattern-matching capabilities of AWK versions and Perl . . . 125 5.2 Comparison of special variables in AWK and Perl . . . 126 5.3 Loading field data into user-defined variables . . . 131 5.4 Using undef in assignments to explicit lists . . . 132 5.5 Syntactic differences for print in AWK and Perl . . . 135 5.6 Custom field separator definitions . . . 137 5.7 Patterns and Actions in AWK and Perl . . . 139 5.8 AWK and Perl programs for simple tasks . . . 141 5.9 Illustration of array indexing syntax using the field array, @F . . . 145 5.10 Using pattern ranges . . . 153 5.11 Relational operators of AWK and Perl . . . 157 5.12 Arithmetic operators of AWK and Perl . . . 159 5.13 Popular built-in functions of AWK and Perl . . . 160 5.14 Perl counterparts to popular AWK functions . . . 161

Chapter 6

6.1 Syntax for file attribute tests . . . 181 6.2 Comparison of supported file attributes in versions of the

find command and Perl . . . 182

Chapter 7

7.1 Tools for data-type conversion . . . 209 7.2 Useful Perl functions for scalars, and their nearest relatives in Unix . . . 210 7.3 The split function . . . 211 7.4 The localtime function . . . 214 7.5 The stat function . . . 216 7.6 The chomp function . . . 220 7.7 The rand function . . . 222 7.8 Useful Perl functions for lists, and their nearest relatives in Unix . . . 223 7.9 Data flow in Unix pipelines vs. Perl functions . . . 224 7.10 The sort function . . . 224 7.11 The grep function . . . 228 7.12 The join function . . . 229 7.13 The map function . . . 233 7.14 The globbing operator . . . 235 7.15 The globbing operator’s FNG metacharacters . . . 236 7.16 Corresponding expressions for the FNG and regex notations . . . 238 7.17 Functions for managing directories . . . 239 7.18 Functions for managing files . . . 240

Chapter 8

8.1 The exit function . . . 253 8.2 Using shift and unshift in the Shell and Perl . . . 255 8.3 The if/else construct . . . 260 8.4 Nested if/else vs. elsif . . . 261 8.5 String operators for concatenation and repetition . . . 265 8.6 Command substitution/interpolation in the Shell and Perl . . . 270 8.7 Controlling and interrogating screen displays using tput options . . . 271 8.8 The system function . . . 276 8.9 The eval function in the Shell and Perl . . . 283

Chapter 9

9.1 Indices and values for the @stooges array . . . 297 9.2 Syntax for using arrays in the Shell and Perl. . . 298 9.3 Syntax for advanced array indexing . . . 300 9.4 Array of phone-owners’ names. . . 309 9.5 Array of phone numbers for phone owners . . . 309 9.6 Storing phone numbers in a hash. . . 309 9.7 Syntax for using hashes in Perl. . . 310 9.8 Syntax for basic and advanced hash indexing . . . 312 9.9 Common list generators in the Shell and their Perl counterparts . . . 326

Chapter 10

10.1 Looping-related differences between the Shell and Perl . . . 332 10.2 The while/until loop. . . 333 10.3 Pre- and post-processing in implicit and explicit loops. . . 338 10.4 Perl’s do while loop and its Shell equivalent . . . 338 10.5 The Shell’s for loop and Perl’s foreach loop. . . 340 10.6 Perl’s for loop. . . 345 10.7 Corresponding loop-control directives for the Shell and Perl . . . 349 10.8 Enhanced while/until loops for the Shell and Perl . . . 353 10.9 The Shell’s select loop . . . 356 10.10 The select loop for Perl . . . 356

Chapter 11

11.1 Syntax for defining and using subroutines . . . 364 11.2 The my, our, and local variable declarations . . . 374

Chapter 12

12.1 Essential functions of the CGI module . . . 422 12.2 Form-related functions of the CGI module . . . 423

1

P A R T

Minimal Perl: for UNIX

Dans le document Minimal Perl (Page 30-34)