Preface |
|
xiii | |
1 Introduction |
|
1 | (18) |
|
|
1 | (3) |
|
Is This the Right Book for You? |
|
|
1 | (1) |
|
What About the Exercises and Their Answers? |
|
|
2 | (1) |
|
What HIM a Perl Course Instructor? |
|
|
3 | (1) |
|
What Does "Perl" Stand For? |
|
|
4 | (4) |
|
Why Did Larry Create Perl? |
|
|
4 | (1) |
|
Why Didn't Larry Just Use Some Other Language? |
|
|
4 | (1) |
|
|
5 | (1) |
|
How Did Perl Get to Be So Popular? |
|
|
6 | (1) |
|
What's Happening with Perl Now? |
|
|
7 | (1) |
|
What's Perl Really Good For? |
|
|
7 | (1) |
|
What Is Perl Not Good For? |
|
|
8 | (1) |
|
|
8 | (2) |
|
|
9 | (1) |
|
Is There Any Kind of Support? |
|
|
9 | (1) |
|
What If I Find a Bug in Perl? |
|
|
10 | (1) |
|
How Do I Make a Perl Program? |
|
|
10 | (5) |
|
|
11 | (2) |
|
What's Inside That Program? |
|
|
13 | (2) |
|
How Do I Compile My Perl Program? |
|
|
15 | (1) |
|
|
15 | (2) |
|
|
17 | (2) |
2 Scalar Data |
|
19 | (24) |
|
|
19 | (4) |
|
All Numbers Have the Same Format Internally |
|
|
20 | (1) |
|
|
20 | (1) |
|
Nondecimal Integer Literals |
|
|
20 | (1) |
|
|
21 | (1) |
|
|
22 | (1) |
|
|
23 | (4) |
|
Single-Quoted String Literals |
|
|
23 | (1) |
|
Double-Quoted String Literals |
|
|
24 | (1) |
|
|
25 | (1) |
|
Automatic Conversion Between Numbers and Strings |
|
|
26 | (1) |
|
|
27 | (2) |
|
Interpreting Nondecimal Numerals |
|
|
28 | (1) |
|
|
29 | (3) |
|
Choosing Good Variable Names |
|
|
30 | (1) |
|
|
31 | (1) |
|
Compound Assignment Operators |
|
|
31 | (1) |
|
|
32 | (5) |
|
Interpolation of Scalar Variables into Strings |
|
|
32 | (2) |
|
Creating Characters by Code Point |
|
|
34 | (1) |
|
Operator Precedence and Associativity |
|
|
34 | (2) |
|
|
36 | (1) |
|
|
37 | (1) |
|
|
37 | (1) |
|
|
38 | (1) |
|
|
39 | (1) |
|
The while Control Structure |
|
|
40 | (1) |
|
|
40 | (1) |
|
|
41 | (1) |
|
|
42 | (1) |
3 Lists and Arrays |
|
43 | (18) |
|
Accessing Elements of an Array |
|
|
44 | (1) |
|
|
45 | (1) |
|
|
45 | (2) |
|
|
46 | (1) |
|
|
47 | (4) |
|
The pop and push Operators |
|
|
49 | (1) |
|
The shift and unshift Operators |
|
|
49 | (1) |
|
|
50 | (1) |
|
Interpolating Arrays into Strings |
|
|
51 | (1) |
|
The foreach Control Structure |
|
|
52 | (3) |
|
Peds Favorite Default: $_ |
|
|
53 | (1) |
|
|
53 | (1) |
|
|
54 | (1) |
|
|
54 | (1) |
|
|
55 | (3) |
|
Using List-Producing Expressions in Scalar Context |
|
|
56 | (1) |
|
Using Scalar-Producing Expressions in List Context |
|
|
57 | (1) |
|
|
58 | (1) |
|
|
58 | (1) |
|
|
59 | (2) |
4 Subroutines |
|
61 | (20) |
|
|
61 | (1) |
|
|
62 | (1) |
|
|
62 | (2) |
|
|
64 | (2) |
|
Private Variables in Subroutines |
|
|
66 | (1) |
|
Variable-Length Parameter Lists |
|
|
67 | (2) |
|
|
67 | (1) |
|
|
68 | (1) |
|
Notes on Lexical (my) Variables |
|
|
69 | (1) |
|
|
70 | (1) |
|
|
71 | (3) |
|
|
72 | (2) |
|
|
74 | (1) |
|
Persistent, Private Variables |
|
|
74 | (2) |
|
|
76 | (3) |
|
|
78 | (1) |
|
|
79 | (2) |
5 Input and Output |
|
81 | (24) |
|
Input from Standard Input |
|
|
81 | (2) |
|
Input from the Diamond Operator |
|
|
83 | (2) |
|
|
85 | (1) |
|
|
85 | (1) |
|
Output to Standard Output |
|
|
86 | (3) |
|
Formatted Output with printf |
|
|
89 | (2) |
|
|
91 | (1) |
|
|
91 | (2) |
|
|
93 | (4) |
|
|
96 | (1) |
|
|
96 | (1) |
|
|
97 | (1) |
|
|
97 | (3) |
|
Warning Messages with warn |
|
|
99 | (1) |
|
|
99 | (1) |
|
|
100 | (1) |
|
Changing the Default Output Filehandle |
|
|
100 | (1) |
|
Reopening a Standard Filehandle |
|
|
101 | (1) |
|
|
101 | (1) |
|
|
102 | (2) |
|
|
104 | (1) |
6 Hashes |
|
105 | (14) |
|
|
105 | (3) |
|
|
107 | (1) |
|
|
108 | (4) |
|
|
109 | (1) |
|
|
110 | (1) |
|
|
111 | (1) |
|
|
112 | (3) |
|
The keys and values Functions |
|
|
112 | (1) |
|
|
113 | (2) |
|
|
115 | (1) |
|
|
115 | (1) |
|
|
115 | (1) |
|
Hash Element Interpolation |
|
|
116 | (1) |
|
|
116 | (1) |
|
|
117 | (2) |
7 Regular Expressions |
|
119 | (22) |
|
|
119 | (2) |
|
|
121 | (2) |
|
|
123 | (2) |
|
|
125 | (4) |
|
|
129 | (3) |
|
|
132 | (2) |
|
|
134 | (2) |
|
Character Class Shortcuts |
|
|
135 | (1) |
|
|
136 | (1) |
|
|
136 | (1) |
|
|
137 | (3) |
|
|
139 | (1) |
|
|
140 | (1) |
8 Matching with Regular Expressions |
|
141 | (22) |
|
|
141 | (1) |
|
|
142 | (6) |
|
Case-Insensitive Matching with /i |
|
|
142 | (1) |
|
Matching Any Character with /s |
|
|
142 | (1) |
|
Adding Whitespace with /x |
|
|
143 | (2) |
|
Combining Option Modifiers |
|
|
145 | (1) |
|
Choosing a Character Interpretation |
|
|
145 | (2) |
|
Beginning- and End-of-Line Anchors |
|
|
147 | (1) |
|
|
148 | (1) |
|
|
148 | (1) |
|
|
149 | (9) |
|
The Persistence of Captures |
|
|
150 | (1) |
|
|
151 | (2) |
|
|
153 | (1) |
|
|
154 | (2) |
|
The Automatic Match Variables |
|
|
156 | (2) |
|
|
158 | (2) |
|
|
159 | (1) |
|
|
159 | (1) |
|
|
160 | (1) |
|
|
160 | (3) |
9 Processing Text with Regular Expressions |
|
163 | (16) |
|
|
163 | (5) |
|
Global Replacements with /g |
|
|
164 | (1) |
|
|
165 | (1) |
|
|
165 | (1) |
|
|
165 | (1) |
|
Nondestructive Substitutions |
|
|
165 | (1) |
|
|
166 | (2) |
|
|
168 | (1) |
|
|
168 | (2) |
|
|
170 | (1) |
|
|
170 | (1) |
|
More Powerful Regular Expressions |
|
|
171 | (7) |
|
|
171 | (2) |
|
|
173 | (1) |
|
Matching Multiple-Line Text |
|
|
174 | (1) |
|
|
174 | (3) |
|
In-Place Editing from the Command Line |
|
|
177 | (1) |
|
|
178 | (1) |
10 More Control Structures |
|
179 | (20) |
|
The unless Control Structure |
|
|
179 | (1) |
|
The else Clause with unless |
|
|
180 | (1) |
|
The until Control Structure |
|
|
180 | (1) |
|
|
181 | (1) |
|
The Naked Block Control Structure |
|
|
182 | (1) |
|
|
183 | (1) |
|
Autoincrement and Autodecrement |
|
|
184 | (1) |
|
The Value of Autoincrement |
|
|
184 | (1) |
|
The for Control Structure |
|
|
185 | (3) |
|
The Secret Connection Between foreach and for |
|
|
187 | (1) |
|
|
188 | (4) |
|
|
188 | (1) |
|
|
189 | (1) |
|
|
190 | (1) |
|
|
191 | (1) |
|
|
192 | (1) |
|
|
193 | (5) |
|
The Value of a Short-Circuit Operator |
|
|
194 | (1) |
|
|
195 | (1) |
|
Control Structures Using Partial-Evaluation Operators |
|
|
196 | (2) |
|
|
198 | (1) |
11 Perl Modules |
|
199 | (12) |
|
|
199 | (1) |
|
|
200 | (3) |
|
Using Your Own Directories |
|
|
201 | (2) |
|
|
203 | (7) |
|
The File::Basename Module |
|
|
204 | (1) |
|
Using Only Some Functions from a Module |
|
|
205 | (1) |
|
|
206 | (1) |
|
|
207 | (1) |
|
|
208 | (1) |
|
|
209 | (1) |
|
|
210 | (1) |
12 File Tests |
|
211 | (14) |
|
|
211 | (7) |
|
Testing Several Attributes of the Same File |
|
|
215 | (2) |
|
Stacked File Test Operators |
|
|
217 | (1) |
|
The stat and lstat Functions |
|
|
218 | (1) |
|
|
219 | (1) |
|
|
220 | (4) |
|
|
221 | (3) |
|
|
224 | (1) |
13 Directory Operations |
|
225 | (20) |
|
The Current Working Directory |
|
|
225 | (1) |
|
|
226 | (1) |
|
|
227 | (2) |
|
An Alternate Syntax for Globbing |
|
|
229 | (1) |
|
|
230 | (2) |
|
Manipulating Files and Directories |
|
|
232 | (1) |
|
|
232 | (1) |
|
|
233 | (2) |
|
|
235 | (4) |
|
Making and Removing Directories |
|
|
239 | (2) |
|
|
241 | (1) |
|
|
241 | (1) |
|
|
242 | (1) |
|
|
242 | (3) |
14 Strings and Sorting |
|
245 | (12) |
|
Finding a Substring with index |
|
|
245 | (2) |
|
Manipulating a Substring with substr |
|
|
247 | (1) |
|
Formatting Data with sprintf |
|
|
248 | (2) |
|
Using sprintf with "Money Numbers" |
|
|
249 | (1) |
|
|
250 | (6) |
|
|
254 | (1) |
|
|
255 | (1) |
|
|
256 | (1) |
15 Process Management |
|
257 | (20) |
|
|
257 | (5) |
|
|
260 | (2) |
|
The Environment Variables |
|
|
262 | (1) |
|
|
263 | (1) |
|
Using Backquotes to Capture Output |
|
|
264 | (4) |
|
Using Backquotes in a List Context |
|
|
267 | (1) |
|
External Processes with IPC::System::Simple |
|
|
268 | (1) |
|
|
269 | (2) |
|
Getting Down and Dirty with fork |
|
|
271 | (1) |
|
Sending and Receiving Signals |
|
|
272 | (3) |
|
|
275 | (2) |
16 Some Advanced Perl Techniques |
|
277 | (18) |
|
|
277 | (6) |
|
|
279 | (2) |
|
|
281 | (1) |
|
|
282 | (1) |
|
|
283 | (6) |
|
|
283 | (4) |
|
More Advanced Error Handling |
|
|
287 | (2) |
|
Picking Items from a List with grep |
|
|
289 | (1) |
|
Transforming Items from a List with map |
|
|
290 | (1) |
|
|
291 | (2) |
|
|
293 | (2) |
A Exercise Answers |
|
295 | (36) |
B Beyond the Llama |
|
331 | (10) |
C A Unicode Primer |
|
341 | (10) |
D Experimental Features |
|
351 | (8) |
Index |
|
359 | |