Introduction | p. xvii |
Getting Started | p. 1 |
Introduction to Perl | p. 3 |
The History | p. 5 |
The Beginning | p. 5 |
Up to Perl 4 | p. 6 |
Introducing Perl 5 | p. 7 |
What 5.6 Brings to the Table | p. 8 |
Platform Support | p. 9 |
Windows | p. 10 |
UNIX | p. 12 |
Mac OS | p. 12 |
Others | p. 12 |
Things You Need to Know | p. 13 |
How It Works | p. 13 |
Installing Perl | p. 15 |
Installing Perl | p. 15 |
Notes About the Platforms | p. 27 |
Where to Get Help | p. 29 |
Creating a Perl Program | p. 32 |
Getting Started | p. 33 |
A Hello Script | p. 37 |
Going a Bit Further | p. 39 |
Moving On | p. 41 |
Mastery Check | p. 42 |
Scalar Data | p. 43 |
Data Types | p. 44 |
Numbers | p. 44 |
Strings | p. 48 |
Variable Assignments | p. 52 |
Naming Scalar Variables | p. 52 |
Assigning Values to Scalar Variables | p. 53 |
Saving Data to Scalar Variables | p. 54 |
What Operators Do | p. 54 |
Common Operators | p. 54 |
More Complex Operators and Functions | p. 64 |
Bit-Manipulation Operators | p. 73 |
Operator Precedence | p. 74 |
Working with Operators | p. 77 |
Type Conversion | p. 77 |
Mastery Check | p. 77 |
Control Structures | p. 79 |
Conditional Statements | p. 80 |
Statement blocks | p. 80 |
The if-then-else Conditional Statement | p. 81 |
The while Conditional Statement | p. 86 |
The until Conditional Statement | p. 88 |
The do while-until Conditional Statement | p. 90 |
The for Conditional Statement | p. 92 |
Creating a Counting Loop | p. 94 |
The foreach Conditional Statement | p. 95 |
The Single Line Conditional Statements | p. 98 |
Control Statements | p. 99 |
The next Control Statement | p. 100 |
The last Control Statement | p. 101 |
The redo Control Statement | p. 102 |
Nested Loops | p. 104 |
Counting and Displaying Odd Numbers | p. 106 |
Mastery Check | p. 107 |
Lists, Arrays, and Hashes | p. 109 |
Lists | p. 110 |
Arrays | p. 114 |
Putting Items In | p. 114 |
Accessing Array Elements | p. 120 |
Working with Arrays | p. 123 |
More Work with Arrays | p. 125 |
Array Slices | p. 126 |
Array Functions | p. 134 |
Working with Stacks | p. 138 |
Hashes | p. 146 |
Mastery Check | p. 155 |
Program Flow and Subroutines | p. 157 |
Organization Basics | p. 158 |
Why You Should Organize | p. 160 |
Okay, Define Logical and Functional! | p. 161 |
Creating Code Segments | p. 164 |
Subroutines | p. 168 |
Declaring | p. 168 |
Using Our Subroutine | p. 170 |
Arguments | p. 171 |
Predefined Subroutines | p. 174 |
Addition Subroutine | p. 176 |
Returning Data | p. 176 |
Advanced Topics | p. 179 |
Temporary Data with local () | p. 180 |
Private Data with my () | p. 184 |
Importing Subroutines from Packages | p. 186 |
Moving On | p. 187 |
Mastery Check | p. 188 |
Applying Your Knowledge | |
Working with Files and Directories | p. 191 |
Basic File Manipulation | p. 192 |
Opening and Closing Files | p. 192 |
Reading and Writing Files | p. 197 |
Reading from Files | p. 200 |
Creating Files | p. 206 |
Obtaining Status Information for a File | p. 212 |
Directory Access | p. 214 |
Moving Around | p. 215 |
Searching for Files | p. 217 |
Mastery Check | p. 219 |
Regular Expressions | p. 221 |
What Are Regular Expressions? | p. 222 |
Understanding a Pattern | p. 222 |
Built-in Operators | p. 223 |
Pattern Matching Syntax | p. 224 |
Regular Expression Options | p. 224 |
Searching for a Regular Expression in a File | p. 232 |
Search and Replace | p. 250 |
Writing a find/replace Application | p. 261 |
Mastery Check | p. 261 |
Packages and Modules | p. 263 |
Definitions | p. 265 |
What Is a Package? | p. 265 |
What Is a Module? | p. 266 |
How Do Packages and Libraries Work? | p. 266 |
Constructor and Destructor | p. 267 |
Loading Libraries | p. 267 |
The package Statement | p. 269 |
The Exporter Module | p. 270 |
Import () | p. 272 |
Importing a Module | p. 273 |
Building a Library | p. 273 |
Do You Really Need To? | p. 274 |
Design Considerations | p. 275 |
Documentation | p. 275 |
Building a Library | p. 276 |
Moving On | p. 280 |
Mastery Check | p. 281 |
Interacting with Databases Using the Perl DBI | p. 283 |
Understanding Databases | p. 285 |
Setting Up Our Database | p. 287 |
Installing PostgreSQL | p. 288 |
Preparing the Database | p. 289 |
Introduction to the DBI | p. 294 |
Installing the DBI Module | p. 294 |
Using the DBI | p. 298 |
Connections | p. 298 |
available_drivers() and data_sources () | p. 299 |
Transaction Management | p. 300 |
Queries | p. 301 |
Warnings and Errors | p. 306 |
Returned Results | p. 307 |
Moving On | p. 310 |
Mastery Check | p. 311 |
Writing CGI Programs | p. 313 |
What Is CGI? | p. 314 |
Quick Introduction to CGI.pm | p. 315 |
CGI Programming Language Options | p. 315 |
Using Perl for CGI Scripts | p. 316 |
Configuring Your Apache CGI Directory | p. 319 |
No-Parse Header Scripts | p. 326 |
Understanding Forms | p. 327 |
Form Construction | p. 327 |
Another Way to Do a Submit Button | p. 336 |
How Forms Are Submitted | p. 338 |
A Simple Perl CGI Program | p. 341 |
Sending and Receiving Data | p. 342 |
URL Encoding | p. 342 |
Environment Variables | p. 343 |
Cookies | p. 344 |
Returning Data | p. 354 |
Processing Our Form | p. 355 |
Quick Formatting | p. 356 |
Extra Things You Can Do Manually | p. 358 |
Creating Your Own Form and Script | p. 364 |
Debugging Your Program | p. 365 |
Moving On | p. 365 |
Mastery Check | p. 366 |
Cross-Platform Functions and Issues | p. 367 |
System () | p. 368 |
Return Codes | p. 370 |
Using the Function | p. 372 |
Using the system () Function on the Mac OS | p. 377 |
Operating System-Specific Issues | p. 379 |
Windows | p. 379 |
Creating a Script That Runs only on Windows | p. 381 |
UNIX | p. 382 |
Mac OS | p. 384 |
Creating a Cross-Platform Script | p. 386 |
Moving On | p. 392 |
Mastery Check | p. 392 |
Error Messages and Debugging | p. 395 |
Understanding Error Messages | p. 396 |
Seeing Errors | p. 396 |
Common Practices | p. 399 |
Debugging Your Problems | p. 401 |
Command Line Options | p. 402 |
The Perl Debugger | p. 402 |
Becoming Familiar with the Perl Debugger | p. 420 |
More Common Practices | p. 420 |
Mastery Check | p. 421 |
Advanced Features and Concepts | p. 423 |
Objected-Oriented Programming | p. 424 |
Encapsulation | p. 428 |
Inheritance | p. 428 |
Polymorphism | p. 432 |
PerlScript | p. 432 |
Using on the Client Side | p. 433 |
But I Have Never Programmed in JavaScript/JScript or VBScript! | p. 434 |
Server-Side Processing | p. 436 |
Windows Script Host | p. 437 |
GUI Components with the Perl/Tk | p. 439 |
What Is Perl/Tk? | p. 440 |
Overview of the Toolkit | p. 440 |
Hello, World! Dialog Box | p. 442 |
Conclusion | p. 444 |
Mastery Check | p. 445 |
Answers to Mastery Checks | p. 447 |
Introduction to Perl | p. 448 |
Scalar Data | p. 448 |
Control Structures | p. 449 |
Lists, Arrays, and Hashes | p. 449 |
Program Flow and Subroutines | p. 450 |
Working with Files and Directories | p. 450 |
Regular Expressions | p. 451 |
Packages and Modules | p. 452 |
Interacting with Databases Using the Perl DBI | p. 452 |
Writing CGI Programs | p. 452 |
Cross-Platform Functions and Issues | p. 453 |
Error Messages and Debugging | p. 453 |
Advanced Features and Concepts | p. 454 |
Index | p. 455 |
Table of Contents provided by Syndetics. All Rights Reserved. |