search for books and compare prices
Tables of Contents for Perl by Example
Chapter/Section Title
Page #
Page Count
Preface
xxi
Acknowledgments
xxii
The Practical Extraction and Report Language
1
8
What Is Perl?
1
1
Who Uses Perl?
2
1
Which Perl?
3
1
Where to Get Perl
3
4
What Version Do I Have?
4
3
What Is CPAN?
7
1
Perl Documentation
7
2
Perl Scripts
9
12
Perl at the Command Line
9
4
The-e Switch
9
1
The-n Switch
10
2
The-c Switch
12
1
Script Setup
13
1
The Script
13
8
Startup
13
2
Comments
15
1
Perl Statements
16
1
Executing the Script
16
1
Sample Script (UNIX, Windows)
16
3
Exercise 1: Getting with It Syntactically
19
2
Getting a Handle On Printing
21
20
The Filehandle
21
1
Words
21
3
Quotes
21
1
Literals (Constants)
22
2
The print Function
24
7
Printing Literals
25
4
The warnings Pragma and the-w Switch
29
2
The strict Pragma and Words
31
1
The Printf Function
31
10
The sprintf Function
35
1
Printing Without Quotes---The Here document
35
4
Exercise 2: A String of Perls
39
2
What's in a Name
41
60
About Perl Variables
41
8
Types
41
1
Scope and the Package
41
1
Naming Conventions
42
1
Assignment Statements
42
2
Quoting Rules
44
5
Scalars, Arrays, and Hashes
49
17
Scalar Variables
49
3
Arrays
52
8
Hashes
60
6
Reading from STDIN
66
6
Assigning Input to a Scalar Variable
66
1
The chop and chomp Functions
67
2
The Read Function
69
1
The getc Function
70
1
Assigning Input to an Array
70
2
Assigning Input to a Hash
72
1
Array Functions
72
18
The chop and chomp Functions (with Lists)
72
1
The exists Function
73
1
The delete Function
74
1
The grep Function
74
1
The join Function
75
1
The map Function
76
2
The pack and unpack Functions
78
1
The pop Function
79
1
The push Function
80
1
The shift Function
80
1
The splice Function
81
2
The split Function
83
4
The sort Function
87
1
The reverse Function
88
1
The unshift Function
89
1
Hash (Associative Array) Functions
90
4
The keys Function
90
1
The values Function
91
1
The each Function
91
1
The delete Function
92
1
The exists Function
93
1
More Hashes
94
7
Loading a Hash from a File
94
2
Special Hashes
96
1
Context
97
1
Exercise 3: The Funny Characters
98
3
Where's The Operator?
101
32
About Perl Operators
101
1
Mixing Data Types
101
2
Precedence and Associativity
103
30
Assignment Operators
105
2
Relational Operators
107
2
Equality Operators
109
3
Logical Operators (Short-Circuit Operators)
112
2
Logical Word Operators
114
2
Arithmetic Operators
116
1
Autoincrement and Autodecrement Operators
117
2
Bitwise Logical Operators
119
3
Conditional Operators
122
2
Range Operators
124
1
Special String Operators and Functions
125
3
Generating Random Numbers
128
1
The Rand/stand Functions
128
3
Exercise 4: Operator, Operator
131
2
If Only, Unconditionally, Forever
133
30
Control Structures, Blocks, and Compound Statements
133
1
Decision Making---Conditional Constructs
133
6
if and unless Statements
133
4
The unless Construct
137
2
Loops
139
24
The while Loop
139
2
The until Loop
141
3
The for Loop
144
2
The foreach Loop
146
4
Loop Control
150
9
The Phoney Switch Statement
159
2
Exercise 5: What Are Your Conditions?
161
2
Regular Expressions--Pattern Matching
163
34
What Is a Regular Expression?
163
1
Expression Modifiers and Simple Statements
164
7
Conditional Modifiers
164
2
The DATA Filehandle
166
3
Looping Modifiers
169
2
Regular Expression Operators
171
24
The m Operator and Matching
171
7
The s Operator and Substitution
178
10
Pattern Binding Operators
188
7
Exercise 6: Is it sed, awk, or grep? Give Perl a Whirl!
195
2
Getting Control--Regular Expression Metacharacters
197
52
Regular Expression Metacharacters
197
48
Metacharacters for Single Characters
200
9
Whitespace Metacharacters
209
3
Metacharacters to Repeat Pattern matches
212
28
The tr or y Function
240
5
Unicode
245
4
Perl and Unicode
246
2
Exercise 7: Is it sed, awk, or grep? Give Perl Another Whirl!
248
1
Getting a Handle on Files
249
40
The User-Defined Filehandle
249
26
Opening Files---The open Function
249
1
Open for Reading
249
6
Open for Writing
255
2
Win32 Files
257
1
Open for Appending
258
1
The select Function
259
1
File Locking with flock
260
1
The seek and tell Functions
261
5
Open for Reading and Writing
266
2
Open for Pipes
268
7
Passing Arguments
275
9
The ARGV Array
275
1
ARGV and the Null Filehandle
276
5
The eof Function
281
2
The -i Switch---Editing Files in Place
283
1
File Testing
284
5
Exercise 8: Getting a Handle on Things
287
2
How Do Subroutines Function?
289
34
Subroutines/Functions
289
34
Defining and Calling a Subroutine
290
3
Passing Arguments
293
8
Prototypes
301
2
Return Value
303
2
Call-by-Reference---Aliases and Typeglobs
305
5
Passing by Pointer
310
7
Autoloading
317
2
BEGIN and END Subroutines (Startup and Finish)
319
1
The subs Function
320
1
Exercise 9: I Can't Seem to Function Without Subroutines
321
2
Modularize It, Package it, and Send it to the Library!
323
32
Packages and Modules
323
7
An Analogy
323
1
Definition
323
1
The Symbol Table
324
6
The Standard Perl Library
330
25
The @INC Array
331
4
Packages and .pl Files
335
4
Modules and .pm Files
339
8
Modules from CPAN
347
5
Exercise 10: I Hid All My Perls in a Package
352
1
Exercise 11: Pack It up and Take It to the Library
353
2
Does This Job Require A Reference?
355
24
What Is a Reference?
355
22
Symbolic versus Hard References
355
3
Hard References
358
2
References and Anonymous Variables
360
1
Nested Data Structures
361
7
References and Subroutintes
368
6
Filehandle References
374
2
The ref Function
376
1
Exercise 12: It's Not Polite to Point!
377
2
Bless Those Things! (Object-Oriented Perl)
379
56
The OOP Paradigm
379
2
Packages and Modules Revisited
379
1
Some Object-Oriented Lingo
380
1
Classes, Objects, and Methods
381
26
Classes and Privacy
381
1
Objects
382
2
The bless Function
384
2
Methods
386
13
Polymorphism and Dynamic Binding
399
6
Destructors and Garbage Collection
405
2
Inheritance
407
15
The @ISA Array and Calling Methods
407
2
$AUTILOAR, sub AUTOLOAD, and UNIVERSAL
409
3
Derived Classes
412
7
Multiple Inheritance
419
1
Overriding a Parent Method
419
3
Public User Interface---Documenting Classes
422
5
pod Files
422
2
pod Commands
424
1
How to Use the pod Interpreters
425
1
Translating pod Documentation into Text
425
2
Translating pod Documentation into HTML
427
1
Using Objects from the Perl Library
427
8
Another Look at the Standard Perl Library
427
2
An Object-Oriented Module from the Standard Perl Library
429
2
Using a Module with Objects from the Standard Perl Library
431
2
Exercise 13: What's the Object of This Lesson?
433
1
Exercise 14: Perls in a Pod
433
2
Those Magic Ties, DBM Stuff, and the Database Hooks
435
24
Tying Variables to a Class
435
14
The tie Function
435
1
Predefined Methods
436
1
Tying a Scalar
436
5
Tying a Array
441
3
Tying a Hash
444
5
DBM Files
449
10
Creating and Assigning Data to a DBM File
450
3
Retrieving Data from a DBM File
453
1
Deleting Entries from a DBM File
454
5
Introduction to Perl Database Programming
459
40
Chapter Overview
459
1
Chapter Contents
459
1
Perl Database Programming
460
1
Perl Programming with an RDBMS
460
8
Installing Perl on Windows Systems
461
1
Installing Perl Modules Using PPM on Windows Systems
462
3
Installing an RDBMS
465
1
Creating a DSN for MSS Examples
466
2
Accessing MSS Using ADO and DBI
468
10
Microsoft SQL Server---Query for Examples 15.1 and 15.3
468
1
Example 15.1: exl.pl ADO Simple Query on MS SQL Server, DSN
469
2
Executing DDL and DML Operations
471
1
Example 15.2: ex2.pl Perl ADO of persons. sql on MSS. DSN-less
472
2
Example 15.3: ex3.pl Perl DBI Simple Query on MS SQL Server
474
2
Example 15.4: Ex4.pl Perl DBI of persons. sql on MSS
476
2
Accessing Oracle Using ADO and DBI
478
20
Oracle---Simple Query for Example 15.5 (ADO) and 15.7 (DBI)
478
1
Creating a DSN for Oracle Examples
479
2
Example 15.5: ex5.pl ADO Simple Query on Oracle, DSN
481
2
Executing DDL and DML Operations in Oracle
483
1
Example 15.6: ex6.pl Perl ADO of persons.sql on Oracle, DSN-less
484
2
Example 15.7: ex7.pl Perl DBI Simple Query on Oracle
486
2
Example 15.8: ex8.pl Perl DBI of persons. sql on Oracle
488
2
Exercise: Non-Programming
490
1
Exercise 15: Introduction to Using MSS
490
2
Exercise 16: Executing persons.sql in MSS
492
2
Exercise 17: Introduction to Using Oracle
494
2
Exercise 18: Executing persons.sql in Oracle
496
2
References
498
1
Interfacing With the System
499
84
System Calls
499
37
Directories and Files
500
3
Directory and File Attributes
503
3
Finding Directories and Files
506
3
Creating a Directory---The mkdir Function
509
1
Removing a Directory---The rmdir Function
510
1
Changing Directories---The chdir Function
511
1
Accessing a Directory via the Directory Filehandle
512
4
Permissions and Ownership
516
5
Hard and Soft Links
521
3
Renaming Files
524
1
Changing Access and Modification Times
525
1
File Statistics
526
2
Low-Level File I/0
528
3
Packing and Unpacking Data
531
5
Processes
536
27
UNIX Processes
536
2
Win32 Processes
538
1
The Environment (UNIX and Windows)
539
1
Processes and Filehandles
540
3
Process Priorities and Niceness
543
2
Password Information
545
5
Time and Processes
550
5
Process Creation UNIX
555
5
Process Creation Win32
560
3
Other Ways to Interface with the Operating System
563
8
The syscall Function and the h2ph Script
563
2
Command Substitution---The Backquotes
565
1
The Shell.pm Module (Perl 5)
566
1
The system Function
567
2
here documents
569
1
Globbing (Filename Expansion and Wildcards)
570
1
Error Handling
571
5
The die Function
572
1
The warn Function
573
1
The eval Function
573
3
Signals
576
7
Report Writing with Pictures
583
16
The Template
583
16
Steps in Defining the Template
583
3
Changing the Filehandle
586
1
Top-of-the-Page Formatting
587
6
The Select Function
593
2
Multiline Fields
595
1
Filling Fields
596
3
Send it Over the Net and Sock it to `EM!
599
32
Networking and Perl
599
1
Client/Server Model
599
1
Network Protocols (TCP/IP)
599
2
Ethernet Protocol (Hardware)
600
1
Internet Protocol (IP)
600
1
Transmission Control Protocol (TCP)
600
1
User Datagram Protocol (UDP)
600
1
Network Addressing
601
9
The pack and unpack Functions
601
2
Ethernet Addresses
603
1
IP Addresses
603
1
Port Numbers
603
1
Perl Protocol Functions
603
3
Perl's Server Functions
606
2
Perl's Host Information Functions
608
2
Sockets
610
7
Types of Sockets
611
1
Socket Domains
611
1
Creating a Socket
612
1
Binding an Address to a Socket Name
613
1
Creating a Socket Queue
614
1
Waiting for a Client Request
614
1
Establishing a Socket Connection
615
1
Socket Shutdown
616
1
Client/Server Programs
617
8
Connection-Oriented Sockets on the Same Machine
617
3
Connection-Oriented Sockets on Remote Machines (Internet Clients and Servers)
620
5
The Socket.pm Module
625
6
CGI and Perl: The Hyper Dynamic Duo
631
104
What Is CGI?
631
2
Internet Communication Between Client and Server
633
5
The HTTP Server
633
1
HTTP Status Codes and the Log Files
634
2
The URL (Uniform Resource Locator)
636
2
Creating a Web Page with HTML
638
4
How HTML and CGI Work Together
642
4
A Simple CGI Script
643
3
Log Files
646
2
Where to Find CGI Applications
648
1
Getting Information Into and Out of the CGI Script
648
5
CGI Environment Variables
649
4
Processing Forms with CGI
653
35
Input Types for Forms
654
1
Creating an HTML Form
655
5
The GET Method
660
3
Processing the Form
663
4
Putting It All Together
667
8
Handling E-mail
675
8
Extra Path Information
683
2
Server Side Includes
685
3
The CGI.pm Module
688
47
Introduction
688
1
Advantages
689
1
Two Styles of Programming with CGI.pm
689
2
How Input from Forms Is Processed
691
12
CGI.pm Form Elements
703
26
HTTP Header Methods
729
2
Exercise 19: Surfing for Perls
731
1
Exercise 20: Let's Use CGI.pm
732
3
APPENDIX A PERL BUILT-INS, PRAGMAS, MODULES, AND THE DEBUGGER
735
48
A.1 Perl Functions
735
29
A.2 Special Variables
764
3
A.3 Perl Pragmas
767
2
A.4 Perl Modules
769
6
A.5 Command Line Switches
775
2
A.6 Debugger
777
6
APPENDIX B SOME HELPFUL SCRIPTS
783
26
B.1 taintperl Script
784
15
Mark Houser
B.2 maxpstat
799
7
John J. Nouveaux
B.3 randomize
806
3
John J. Nouveaux
APPENDIX C AN OBJECT-ORIENTED PERL/CGI PROGRAM
809
12
C.1 The analyze.cgi Program and Associated Files
10
811
APPENDIX D HTML DOCUMENTS: A BASIC INTRODUCTION
821
18
D.1 Intro to the Intro
821
1
D.2 What is HTML?
821
1
D.2.1 HTML: It Used to Be as Easy as Falling Off a Log
821
1
D.3 HTML Tags
822
2
D.3.1 Required Elements
823
1
D.3.2 The Order of the Required Elements and Their Tags
823
1
D.3.3 The Elements: What They Are and How They Are Used
823
1
D.4 The Minimal HTML Document
824
3
D.4.1 Headings
824
1
D.4.2 Tags to Separate Text
825
1
D.4.3 Lists
825
1
D.4.4 Tables for Fun and Profit
826
1
D.5 Character Formatting
827
1
D.5.1 Logical Tags
827
1
D.5.2 Physical Tags
827
1
D.6 Linking
827
1
D.6.1 Creating a Link
827
1
D.6.2 Links to a URL (Uniform Resource Locator)
828
1
D.7 Adding Comments
828
1
D.8 Case Sensitivity
828
1
D.9 Graphics and Images
829
3
D.9.1 Creating an Inline Image
829
1
D.9.2 The Complex Tag
829
1
D.9.3 Sizing and Placing the Image
829
1
D.9.4 Creating a Text Alternative for an Image
830
1
D.9.5 Where Do I Find Graphics?
830
1
D.9.6 Background Graphics
831
1
D.9.7 Creating Backgrounds
831
1
D.9.8 Default Colors
831
1
D.9.10 Bars, Bullets, and Icons
832
1
D.9.11 Graphics Update
832
1
D.10 External Sights 'n' Sounds
832
1
D.10.1 Troubleshooting
832
2
D.10.2 Ask Heloise!
833
1
D.11 Some Sites that Help You with HTML
834
1
D.11.1 Metatags, Cascading Style Sheets, and Java
834
3
D.11.2 Metatags Example (Part 1)
834
1
D.11.3 Metatags Example (Part 2)
835
1
D.11.4 Metatags Example (Part 3)
835
1
D.11.5 Style Sheet Example
835
1
D.12 JavaScript Example
836
1
D.13 Looking Behind the Scenes (or, What Did We Do Before the Right-Click?)
837
1
D.14 What About Frames?
837
1
Some Final Thoughts
837
2
Index
839