You are previewing Sams Teach Yourself Perl in 24 Hours.
O'Reilly logo
Sams Teach Yourself Perl in 24 Hours

Book Description

Even if you're new to Perl, Sams Teach Yourself Perl in 24 Hours teaches you everything you need to know to begin producing useful CGI programs quickly. This book provides you with a solid foundation in the basics of the Perl language, so you can easily move on to more advanced books and techniques. Special attention is paid to those features that trouble new users. Building on that knowledge, you will begin to interact with your file system, operating system, and network environment. Then move on to creating useful CGI programs, such as data collection, shopping cart, server push, and e-mail forms.

Table of Contents

  1. Copyright
  2. About the Author
  3. Acknowledgments
  4. Tell Us What You Think!
  5. Introduction
  6. Perl Fundamentals
    1. Getting Started with Perl
      1. Installing Perl
      2. Documentation
      3. Your First Program
      4. Summary
      5. Q&A
      6. Workshop
    2. Perl's Building Blocks: Numbers and Strings
      1. Literals
      2. Scalar Variables
      3. Expressions and Operators
      4. More Operators
      5. Exercise: Interest Calculator
      6. Summary
      7. Q&A
      8. Workshop
    3. Controlling the Program's Flow
      1. Blocks
      2. The if Statement
      3. Looping
      4. Other Flow-Control Tools
      5. Exercise: Finding Primes
      6. Summary
      7. Q&A
      8. Workshop
    4. Stacking Building Blocks: Lists and Arrays
      1. Putting Things into Lists and Arrays
      2. Getting Elements Out of an Array
      3. Manipulating Arrays
      4. Exercise: Playing a Little Game
      5. Summary
      6. Q&A
      7. Workshop
    5. Working with Files
      1. Opening Files
      2. Reading
      3. Writing
      4. Free Files, Testing Files, and Binary Data
      5. Summary
      6. Q&A
      7. Workshop
    6. Pattern Matching
      1. Simple Patterns
      2. The Metacharacters
      3. Substitution
      4. Exercise: Cleaning Up Input Data
      5. Pattern Matching Odds and Ends
      6. Summary
      7. Q&A
      8. Workshop
    7. Hashes
      1. Filling Your Hash
      2. Getting Data Out of a Hash
      3. Lists and Hashes
      4. Hash Odds and Ends
      5. Useful Things to Do with a Hash
      6. Exercise: Creating a Simple Customer Database with Perl
      7. Summary
      8. Q&A
      9. Workshop
    8. Functions
      1. Creating and Calling Subroutines
      2. Scope
      3. Exercise: Statistics
      4. Function Footnotes
      5. Summary
      6. Q&A
      7. Workshop
  7. Advanced Features
    1. More Functions and Operators
      1. Searching Scalars
      2. Transliteration, Not Substitution
      3. A Better print
      4. Exercise: A Formatted Report
      5. A List as a Stack
      6. Summary
      7. Q&A
      8. Workshop
    2. Files and Directories
      1. Getting a Directory Listing
      2. Exercise: The UNIX grep
      3. Directories
      4. UNIX Stuff
      5. Everything You Ever Wanted to Know About THAT File
      6. Exercise: Renaming Files En Masse
      7. Summary
      8. Q&A
      9. Workshop
    3. System Interaction
      1. The system() Function
      2. Capturing Output
      3. Pipes
      4. First Lesson in Portability
      5. Summary
      6. Q&A
      7. Workshop
    4. Using Perl's Command-Line Tools
      1. What Is the Debugger?
      2. Exercise: Finding the Bug
      3. Other Command-Line Stuff
      4. Summary
      5. Q&A
      6. Workshop
    5. References and Structures
      1. Reference Basics
      2. Recipes for Structures
      3. Exercise: Another Game, Maze
      4. Summary
      5. Q&A
      6. Workshop
    6. Using Modules
      1. Gentle Introduction
      2. A Quick Tour
      3. Full List of Standard Modules
      4. Summary
      5. Q&A
      6. Workshop
    7. Finding Permanence
      1. DBM Files
      2. Exercise: A Free-Form Memo Pad
      3. Regular Files as Databases
      4. Random File Access
      5. Locking
      6. Summary
      7. Q&A
      8. Workshop
    8. The Perl Community
      1. What's Perl All About, Anyway?
      2. The Comprehensive Perl Archive Network (CPAN)
      3. Your Next Steps
      4. Other Resources
      5. Summary
      6. Q&A
      7. Workshop
  8. Using Perl for CGI
    1. Introduction to CGI
      1. Browsing the Web
      2. Don't Skip This Section
      3. Your First CGI Program
      4. What to Do When Your CGI Program Doesn't Work
      5. Summary
      6. Q&A
      7. Workshop
    2. Basic Forms
      1. How Forms Work
      2. Passing Information to Your CGI Program
      3. Web Security 101
      4. A Guestbook
      5. Summary
      6. Q&A
      7. Workshop
    3. Complex Forms
      1. The Stateless Web
      2. Hidden Fields
      3. A Multipage Survey
      4. Summary
      5. Q&A
      6. Workshop
    4. Manipulating HTTP and CGI
      1. The HTTP Conversation
      2. More Details on Calling CGI Programs
      3. Server-Side Includes
      4. Looking Out the Window
      5. Redirection
      6. Summary
      7. Q&A
      8. Workshop
    5. Cookies
      1. What's a Cookie?
      2. Advanced Cookie Stuff
      3. Problems with Cookies
      4. Summary
      5. Q&A
      6. Workshop
    6. Email from CGI
      1. A Primer in Internet Mail
      2. A Mailing Function
      3. Sending Mail from a Web Page
      4. Summary
      5. Q&A
      6. Workshop
    7. Server Push and Hit Counters
      1. What Is Server Push?
      2. Hit Counters
      3. Summary
      4. Q&A
      5. Workshop
    8. Making an Interactive Site
      1. Borrowing Content
      2. Survey Says?
      3. Summary
      4. Q&A
      5. Workshop
  9. Appendix
    1. Installing Modules
      1. Picking the Right Module
      2. Installing the Modules Under…
      3. What to Do When You're Not Allowed to Install Modules
  10. Index