search for books and compare prices
Tables of Contents for Beginning Perl
Chapter/Section Title
Page #
Page Count
Introduction
1
1
A Potted History
1
1
Why Perl?
2
2
It's Free
3
1
What Is Perl Used For?
3
1
Windows, UNIX, and Other Operating Systems
4
1
The Prompt
4
1
What Do I Need to Use This Book?
5
10
How Do I Get Perl?
6
4
How to Get Help
10
3
Perl Resources
13
2
Conventions
15
2
Downloading the Source Code
16
1
Exercises
16
1
Errata
17
1
Customer Support
17
2
First Steps In Perl
19
18
Programming Languages
19
3
Interpreted vs. Compiled Source Code
20
1
Libraries, Modules and Packages
21
1
Why is Perl Such A Great Language?
22
2
It's Really Easy
22
1
Flexibility Is Our Watchword
22
1
Perl on the Web
22
1
The Open Source Effort
23
1
Developers Releases and Topaz
23
1
Our First Perl Program
24
7
Program Structure
28
1
Documenting Your Programs
28
1
Keywords
29
1
Statements and Statement Blocks
29
2
ASCII and Unicode
31
2
Escape Sequences
32
1
White Space
32
1
Number Systems
33
1
The Perl Debugger
34
1
Summary
34
1
Exercises
35
2
Working with Simple Values
37
38
Types of Data
37
9
Numbers
38
1
Binary, Hexadecimal and Octal Numbers
39
2
Strings
41
1
Single-vs Double-quoted strings
41
3
Alternative Delimiters
44
1
Here-Documents
44
1
Converting between Numbers and Strings
45
1
Operators
46
14
Numeric Operators
46
1
Arithmetic Operators
46
3
Bitwise Operators
49
2
Truth and Falsehood
51
2
Boolean Operators
53
2
String Operators
55
2
String Comparison
57
2
Operators To Be Seen Later
59
1
Operator Precedence
59
1
Variables
60
8
Modifying A Variable
61
1
Operating and Assigning at Once
62
1
Autoincrement and Autodecrement
63
1
Multiple Assignments
64
1
Scoping
65
1
How It Works
66
1
Variable Names
67
1
Variable Interpolation
68
3
Currency Converter
69
 
Introducing
70
71
Summary
71
1
Exercises
72
3
Lists and Hashes
75
38
Lists
75
11
Simple Lists
76
1
Less Simple Lists
77
3
Accessing List Values
80
2
List Slices
82
2
Ranges
84
2
Combining Ranges and Slices
86
1
Arrays
86
18
Assigning Arrays
87
2
Scalar vs List Context
89
1
Adding to an Array
90
1
Accessing an Array
91
1
Accessing Single Elements
91
3
Accessing Multiple Elements
94
2
Running Through Arrays
96
3
Array Functions
99
5
Hashes
104
4
Creating a Hash
104
2
Working with Hash Values
106
1
Adding, Changing and Taking Values Away from a Hash
107
1
Accessing Multiple Values
108
2
Summary
110
1
Exercises
111
2
Loops and Decisions
113
34
Deciding If...
114
14
Logical Operators Revisited
119
1
Comparing Numbers
120
1
Comparing Strings
121
2
Other Tests
123
1
Logical Conjunctions
123
1
Running Unless...
124
1
Statement Modifiers
124
1
Using Logic
125
1
Multiple Choice
125
1
if elsif else
126
2
More Elegant Solutions
128
1
1, 2, Skip A Few, 99, 100
128
6
for Loops
129
1
Choosing an Iterator
130
1
What We Can Loop Over
131
1
Aliases and Values
131
1
Statement Modifiers
132
2
Looping While...
134
5
while
135
1
Infinite Loops
136
2
Running at Least Once
138
1
Statement Modifying
138
1
Looping Until
139
1
Controlling Loop Flow
139
5
Breaking Out
140
1
Going onto the Next
141
3
Goto
144
1
Summary
144
1
Exercises
145
2
Regular Expressions
147
32
What Are They?
148
18
Patterns
148
3
Interpolation
151
1
Escaping Special Characters
152
1
Anchors
153
2
Shortcuts and Options
155
3
Posix and Unicode Classes
158
1
Alternatives
158
1
Repetition
159
2
Summary Table
161
1
Backreferences
162
1
How the Engine Works
163
3
Working with RegExps
166
6
Substitution
166
1
Changing Delimiters
167
1
Modifiers
168
1
Split
169
1
Join
170
1
Transliteration
171
1
Common Blunders
171
1
More Advanced Topics
172
4
Inline Comments
172
1
Inline Modifiers
172
1
Grouping without Backreferences
173
1
Lookaheads and Lookbehinds
174
2
Backreferences (again)
176
1
Summary
176
1
Exercises
177
2
Files and Data
179
38
Filehandles
179
10
Reading Lines
181
2
Creating Filters
183
2
Reading More Than One Line
185
1
What's My Line (Separator)?
186
2
Reading Paragraphs at a Time
188
1
Reading Entire Files
189
1
Writing To Files
189
11
Opening a File for Writing
189
1
Writing on a Filehandle
190
5
Accessing Filehandles
195
1
Writing Binary Data
196
1
Selecting a Filehandle
197
2
Buffering
199
1
Permissions
200
1
Opening Pipes
201
6
Piping In
202
3
Piping Out
205
2
File Tests
207
5
Directories
212
2
Globbing
212
1
Reading Directories
213
1
Summary
214
1
Exercises
215
2
References
217
26
What Is a Reference?
217
1
Anonymity
218
1
The Lifecycle of a Reference
218
13
Reference Creation
218
2
Anonymous References
220
2
Using References
222
2
Array Elements
224
1
Reference Modification
225
1
Hash References
226
1
Notation Shorthands
227
3
Reference Counting and Destruction
230
1
Counting Anonymous References
231
1
Using References for Complex Data Structures
231
9
Matrices
231
1
Autovivification
232
4
Trees
236
3
Linked Lists
239
1
Summary
240
1
Exercises
241
2
Subroutines
243
36
The `Difference' Between Functions and Subroutines
244
1
Usually
244
1
In Perl
244
1
Understanding Subroutines
245
4
Defining a Subroutine
245
2
Order of Declaration
247
2
Subroutines for Calculation
249
6
Parameters and Arguments
249
1
Return Values
250
2
The return Statement
252
1
Caching
252
1
Context
253
1
Subroutine Prototypes
254
1
Understanding Scope
255
5
Global Variables
255
3
Lexical Variables
258
1
Runtime Scope
258
2
When to Use my() And When to Use local
260
1
Passing More Complex Parameters
260
6
@_ Provides Aliases!
260
1
Lists Always Collapse
261
1
Passing References to a Subroutine
262
1
Passing Arrays and Hashes to a Subroutine
263
1
Passing Filehandles to a Subroutine
264
1
Default Parameter Values
265
1
Named Parameters
266
1
References to Subroutines
266
2
Declaring References to Subroutines
266
1
Calling a Subroutine Reference
266
1
Callbacks
267
1
Arrays and Hashes of References to Subroutines
268
1
Recursion
268
7
Style Point: Writing Big Programs
275
1
Summary
276
1
Exercises
277
2
Running and Debugging Perl
279
30
Error Messages
280
3
Syntax Error Checklist
281
1
Missing Semicolons
281
1
Missing Open/Close Brackets
281
1
Runaway String
282
1
Missing Comma
283
1
Brackets around Conditions
283
1
Barewords
283
1
Diagnostic Modules
283
7
warnings
284
2
strict
286
3
diagnostics
289
1
Perl Command Line Switches
290
10
-e
291
1
-n and -p
292
2
-c
294
1
-i
295
1
-M
295
1
-s
296
2
-I and @INC
298
1
-a and -F
298
1
-l and--O
299
1
-T
299
1
Debugging Techniques
300
2
Before the Debugger...
300
1
Debugging Prints
300
1
Pare It Down
300
1
Context
301
1
Scope
301
1
Precedence
301
1
Defensive Programming
302
3
Strategy
302
1
Check Your Return Values
303
1
Be Prepared for the Impossible
303
1
Never Trust the User
303
1
Definedness and Existence
303
1
Have Truthful, Helpful Comments
304
1
Keep the Code Clean
304
1
Summary
305
1
Exercises
305
4
Modules
309
26
Types of Module
309
1
Why Do I Need Them?
310
2
Including Other Files
310
1
do
310
1
require
311
1
use
312
1
Changing @INC
312
1
Package Hierarchies
312
1
Exporters
313
1
The Perl Standard Modules
314
8
File::Find
314
2
Getopt::Std
316
1
Getopt::Long
317
1
File::Spec
318
1
Benchmark
318
2
Win32
320
2
CPAN
322
10
Installing Modules with PPM
323
1
Installing a Module Manually
324
2
The CPAN Module
326
3
Bundles
329
1
Bundle::LWP
330
1
Bundle::libnet
331
1
Submitting Your Own Module to CPAN
331
1
Summary
332
3
Object-Oriented Perl
335
42
Working with Objects
335
10
Turning Tasks into OO Programs
336
1
Are Your Subroutines Tasks?
336
1
Do You Need Persistence?
336
1
Do You Need Sessions?
336
1
Do You Need OO?
336
1
Do You Want The User To Be Unaware Of The Object?
337
1
Are You Still Unsure?
337
1
Improving Your Vocabulary
337
1
Objects
337
1
Attributes
338
1
Methods
338
1
Classes
339
1
Polymorphism
339
1
Encapsulation
340
1
Inheritance
340
1
Constructors
341
1
Destructors
341
4
Rolling Your Own
345
19
Bless You, My Reference
345
2
Storing Attributes
347
1
The Constructor
348
1
Considering Inheritance
349
1
Providing Attributes
349
2
Creating Methods
351
2
Distinguishing Class and Object Methods
353
1
Get-Set Methods
354
1
Class Attributes
355
3
Privatizing Your Methods
358
2
Utility Methods
360
1
Death of an Object
361
1
Our Finished Class
362
2
Inheritance
364
5
What is it?
364
1
Adding New Methods
365
1
Overriding Methods
366
3
Ties
369
5
Summary
374
1
Exercises
375
2
Introduction to CGI
377
56
How Do I Get It to Work?
377
4
Setting Up CGI on UNIX
377
1
Apache
378
1
Starting and Stopping Apache
378
1
DocumentRoot and cgi-bin
379
1
Setting up Perl CGI on Windows
379
1
Internet Information Server
380
1
Personal Web Server
380
1
Using Windows Web Servers
381
1
Writing CGI Scripts
381
8
Basic CGI
381
1
Plain Text
382
1
HTML Text
382
2
The CGI Environment
384
4
HTTP Commands
388
1
The GET Method
388
1
The POST Method
389
1
Writing Interactive CGI Scripts
389
31
A Form-Based Example
390
1
Passing Parameters with CGI.pm
390
1
Checking the HTTP Method
391
1
Determining the Execution Environment
392
1
Generating HTML Programmatically
392
5
The Environment Dumper Rewritten
397
1
Generating the HTTP Header
398
2
Generating the Document Header
400
3
Producing Human-Readable HTML
403
1
Generating HTML Forms
404
1
Generating Self-Referential URLs
405
2
Using the Same Script to Generate and Process Forms
407
2
Saving and Loading CGI State
409
2
Redirecting from a CGI Script
411
1
Regenerating Pages with Server Push
412
3
Cookies and Session Tracking
415
5
Debugging CGI Scripts
420
2
Using CGI.pm to Debug Scripts from the Command Line
421
1
CGI Security
422
9
An Example of an Insecure CGI Script
422
1
Executing External Programs
423
2
Reading and Writing to External Programs
425
1
Taint Checking
426
2
An Example of a More Secure CGI Script
428
1
CGI Wrappers
429
1
A Simple Security Checklist
429
2
Summary
431
2
Perl and Databases
433
54
Perl and DBM
434
15
Which DBM Implementation to Use
434
1
Accessing DBM Databases
435
1
Opening a DBM Database
435
1
Checking the State of a DBM Database
436
1
Creating DBM Databases
437
1
Emptying the Contents of a DBM Database
437
1
Closing a DBM Database
437
1
Adding and Modifying DBM Entries
437
1
Reading DBM Entries
438
1
Deleting from a DBM Database
438
5
Writing Portable DBM Programs with the AnyDBM Module
443
1
Copying from One DBM Format to Another
444
1
Complex Data Storage
445
1
Multi-Level DBM (MLDBM)
446
3
Beyond Flat Files and DBM
449
1
Introducing Relational Databases
450
1
Introducing DBI
450
10
So What Do We Need?
451
1
Installing DBI
452
2
What's Available
454
2
Our DB of Choice-MySQL
456
1
Installing on Windows
457
1
Installing on Linux
457
2
Setting up the Root Account
459
1
Testing Our MySQL Server
459
1
Installing DBD::MySQL
459
1
What's Available Again?
460
1
First Steps-The Database Cycle
460
25
Connecting To A Database
460
1
Connecting To A Remote Database
461
1
Connecting With The Environment
462
1
The Fourth Parameter-Connection Flags
463
1
Disconnecting From a Database
464
1
Interacting With The Database
465
2
Creating a Table
467
3
Populating a Table With Information
470
2
A Note on Quoting
472
2
Keeping the Table up to Date
474
1
Pulling Values from the Database
475
3
Where Do the Records Go?
478
2
Fetching a Single Value
480
1
Binding Columns
480
2
Fetching All Results
482
1
Extracting Column Information From Statements
482
2
Removing Information From The Table
484
1
Summary
485
2
The World of Perl
487
36
IPC and Networking
487
15
Running Programs
488
1
system
489
1
Processes and IPC
490
1
Signals
490
2
Trapping Signals
492
1
Fork, Wait and Exec
493
1
Networking
494
1
IP Addresses
495
1
Sockets and Ports
495
1
Domain Name Service
496
1
Networking Clients
496
1
Writing Clients
497
1
IO::Socket
497
1
Blocking and IO::Select
498
1
Servers with IO::Socket
499
3
Graphical Interfaces
502
4
Widgets
502
1
Perl/Tk
503
1
Perl/GTK+ and Perl/GNOME
503
1
Glade
504
1
Perl/Qt
505
1
Perl Win32 Module
506
1
Perl Math
506
12
BigInt and BigFloat
506
4
Perl Data Language (PDL)
510
1
Simple Trigonometry
510
2
Adding Complex Number Support
512
1
Security and Cryptography
513
1
crypt--Password Security
513
2
Public Key Cryptography
515
3
Working With Data
518
2
LDAP
518
1
Different Types of Data-One Way to Present It
519
1
Working on the Web
520
1
Log Files
520
1
PerlScript
520
1
Communicating with C
520
1
Using C from Perl
520
1
Embedding Perl
521
1
The End of the Beginning
521
2
Appendix A: Regular Expressions
523
8
Appendix B: Special Variables
531
8
Appendix C: Function Reference
539
28
Appendix D: The Perl Standard Modules
567
12
Appendix E: Command Line Reference
579
6
Appendix F: The ASCII Character Set
585
8
Appendix G: Licenses
593
10
Appendix H: Solutions to Exercises
603
20
Appendix J: Support, Errata and P2P.Wrox.Com
623
8
Index
631