Sams Teach Yourself Perl in 21 Days, Second Edition

Book description

Sams Teach Yourself Perl in 21 Days covers the basics of Perl in the first few chapters, and then moves on to practical issues of Perl and in-depth discussions of more advanced topics. Later chapters also delve into software engineering topics, with discussions of modular code and object-oriented programming. CGI is covered in one chapter, but it is not the focus on the book. The book relies heavily on longer working examples and code, as opposed to small snippets and code fragments, and each chapter includes two to three smaller complete examples and one major one that illustrates most of the concepts for that chapter and builds on the chapters before it. Written by Laura Lemay, this is her third major book after Sams Teach Yourself Web Publishing with HTML in 21 Days and Sams Teach Yourself Java in 21 Days.

Table of contents

  1. Copyright
  2. About the Authors
  3. Acknowledgments
  4. Tell Us What You Think!
  5. Getting Started
    1. An Introduction to Perl
      1. What Is Perl and Where Did It Come From?
      2. Why Learn Perl?
      3. Getting Started Programming in Perl
      4. An Example: The Ubiquitous Hello World
      5. Another Example: Create Hello World As a Script
      6. Another Example: Echo
      7. A Third Example: The Cookie Monster
      8. Going Deeper
      9. Summary
      10. Q&A
      11. Workshop
    2. Working with Strings and Numbers (Scalar Data)
      1. Scalar Data and Scalar Variables
      2. Constructing Perl Scripts
      3. Arithmetic Operators
      4. One-Liners: Simple Calculator
      5. An Example: Converting Fahrenheit to Celsius
      6. Operators for Tests and Comparisons
      7. Another Example: More Cookies
      8. Going Deeper
      9. Summary
      10. Q&A
      11. Workshop
    3. More Scalar Data and Operators
      1. Assignment Operators
      2. Increment and Decrement Operators
      3. String Concatenation and Repetition
      4. Operator Precedence and Associativity
      5. Using Patterns to Match Digits
      6. An Example: Simple Statistics
      7. Input and Output
      8. Another Example: Stocks
      9. A Note About Using Functions
      10. Going Deeper
      11. Summary
      12. Q&A
      13. Workshop
    4. Working with Lists and Arrays
      1. List Data and Variables
      2. Defining and Using Lists and Arrays
      3. An Example: More Stats
      4. List and Scalar Context
      5. Input, Output, and Lists
      6. Going Deeper
      7. Summary
      8. Q&A
      9. Workshop
    5. Working with Hashes
      1. Hashes Versus Arrays and Lists
      2. Defining and Using Hashes
      3. An Example: Frequencies in the Statistics Program
      4. Another Example: Alphabetical Lists of Names
      5. A Few More Patterns
      6. Yet Another Example: Stock Price Converter
      7. Going Deeper
      8. Summary
      9. Q&A
      10. Workshop
    6. Conditionals and Loops
      1. Complex Statements and Blocks
      2. Conditionals
      3. while Loops
      4. An Example: Pick a Number
      5. Iteration with foreach and for Loops
      6. Controlling Loops
      7. Using the $_ (default) Variable
      8. Input from Files with while Loops and <>
      9. Going Deeper
      10. Summary
      11. Q&A
      12. Workshop
    7. Exploring a Few Longer Examples
      1. Statistics with a Better Histogram
      2. A Number Speller
      3. Text-to-HTML Converter Script
      4. Summary
  6. Doing More
    1. Manipulating Lists and Strings
      1. Array and Hash Slices
      2. Sorting Lists
      3. Searching
      4. An Example: More Names
      5. Modifying List Elements
      6. Other Ways to Mess with Lists
      7. Manipulating Strings
      8. Going Deeper
      9. Summary
      10. Q&A
      11. Workshop
    2. Pattern Matching with Regular Expressions
      1. The Whys and Wherefores of Pattern Matching
      2. Pattern Matching Operators and Expressions
      3. Simple Patterns
      4. Matching Groups of Characters
      5. Matching Multiple Instances of Characters
      6. An Example: A Guessing Program
      7. More About Building Patterns
      8. Another Example: Counting
      9. Pattern Precedence
      10. Going Deeper
      11. Summary
      12. Q&A
      13. Workshop
    3. Doing More with Regular Expressions
      1. Extracting Matches
      2. An Example: Extracting Attributes from HTML Tags
      3. Using Patterns for Search and Replace
      4. More About split
      5. Matching Patterns over Multiple Lines
      6. A Summary of Options and Escapes
      7. An Example: Image Extractor
      8. Going Deeper
      9. Summary
      10. Q&A
      11. Workshop
    4. Creating and Using Subroutines
      1. Subroutines Versus Functions
      2. Defining and Calling Basic Subroutines
      3. An Example: Son of Stats
      4. Returning Values from Subroutines
      5. Using Local Variables in Subroutines
      6. Passing Values into Subroutines
      7. Subroutines and Context
      8. Another Example: Stats with a Menu
      9. Going Deeper
      10. Summary
      11. Q&A
      12. Workshop
    5. Debugging Perl
      1. Using the Debugger: A Simple Example
      2. Starting and Running the Debugger
      3. Perl Debugger Command Reference
      4. Using a Graphical Debugger
      5. Going Deeper
      6. Summary
      7. Q&A
      8. Workshop
    6. Scope, Modules, and Importing Code
      1. Global Variables and Packages
      2. Local Scope and Variables
      3. Using Perl Modules
      4. An Example: Using the Text::Wrap Module
      5. Using Modules from CPAN (The Comprehensive Perl Archive Network)
      6. Going Deeper
      7. Summary
      8. Q&A
      9. Workshop
    7. Exploring a Few Longer Examples
      1. A Searchable Address Book (address.pl)
      2. A Web Log Processor (weblog.pl)
      3. Summary
  7. Advanced Perl
    1. Working with Files and I/O
      1. Input and Output with File Handles
      2. An Example: Extract Subjects and Save Them
      3. File Tests
      4. A File Test Example
      5. Working with @ARGV and Script Arguments
      6. Another Example
      7. Going Deeper
      8. Summary
      9. Q&A
      10. Workshop
    2. Using Perl for CGI Scripting
      1. Before You Start
      2. How CGI Works
      3. Building a CGI Script, From Form to Response
      4. Testing the Script
      5. Developing CGI Scripts with CGI.pm
      6. An Example: Survey
      7. Going Deeper
      8. Summary
      9. Q&A
      10. Workshop
    3. Managing Files and Directories
      1. Managing Files
      2. Managing and Navigating Directories
      3. An Example: Creating Links
      4. Going Deeper
      5. Summary
      6. Q&A
      7. Workshop
    4. Perl and the Operating System
      1. Unix Features in Perl
      2. Perl for Windows
      3. Going Deeper
      4. Summary
      5. Q&A
      6. Workshop
    5. Working with References
      1. What Is a Reference?
      2. The Basics: A General Overview of How to Use References
      3. Using References with Subroutine Arguments and Return Values
      4. Other Ways of Using References
      5. Creating Nested Data Structures with References
      6. Building Data Structures with Existing Data
      7. Accessing Elements in Nested Data Structures
      8. Another Example: A Database of Artists and Their Works
      9. Avoiding the Use of References
      10. Going Deeper
      11. Summary
      12. Q&A
      13. Workshop
    6. Odds and Ends
      1. Perl One-Liners
      2. Object-Oriented Programming
      3. An Example: Using Object-Oriented Modules
      4. Sockets
      5. POD (Plain Old Documentation) Files
      6. Evaluating Code On-the-Fly
      7. Commonly Used Modules
      8. Creating International Perl Scripts
      9. Script Security with Taint Checking
      10. PerlScript
      11. What's Coming in Perl 6
      12. Going Deeper
      13. Summary
      14. Q&A
      15. Workshop
    7. Exploring a Few Longer Examples
      1. A Stock Portfolio Manager
      2. A Web-Based To Do List (todolist.pl)
      3. Summary
  8. Appendixes
    1. Perl Functions
      1. For More Information
      2. Perl Functions, in Alphabetical Order
    2. Installing Perl on a Unix System
      1. Do You Need to Install Perl?
      2. Obtaining Perl
      3. Extracting and Compiling Perl
      4. For More Information
    3. Installing Perl for Windows
      1. Downloading Perl for Windows
      2. Installing Perl for Windows
      3. Running Perl for Windows
      4. Downloading the Perl Source Code
      5. Getting More Information
  9. Index

Product information

  • Title: Sams Teach Yourself Perl in 21 Days, Second Edition
  • Author(s): Laura Lemay, Rafe Colburn
  • Release date: May 2002
  • Publisher(s): Sams
  • ISBN: 0672320355