Scott/Jones · Scott/Jones · Scott/Jones · Scott/Jones · Scott/Jones · Scott/Jones · Scott/Jones · Scott/Jones

Home | Textbook Catalog | Order Book | Syllabi



Save 12% over most
bookstore prices by ordering
directly from Scott/Jones!


Practical Perl with CGI Applications

by Elizabeth Chang
Hood College

Companion Web Site


Chances are, your bookshelf is already filled with comprehensive references to Perl. Chances are, none of those books is a very good learning tools. Chances are, you're going to like what you see in Practical Perl with CGI Applications.



  • is not a comprehensive reference on Perl.

  • does not provide "cookbook" recipes for common CGI applications.

  • is a teaching tool, focusing on learning concepts and programming skills.


  1. introduces new concepts and language features using short examples that highlight details of syntax and usage. The author then uses those concepts in complete working examples.   

  2. uses a spiral approach. New language concepts are introduced  in their most elementary form, as they are needed.  Finally concepts are expanded upon in later sections or chapters.

  3. emphasizes learning the elements of and developing an understanding of programming in the intricate environment of the Internet through complete, functional, readable scripts to be executed.  

Let's Get Specific

Do your students complain about "cryptic syntax"? Those students won't complain about Chang.

Chang emphasizes clarity over brevity by presenting new language elements in a form that is the most likely to be comfortable for beginners.  After the students practice using the basic forms, Chang explains more advanced styles, and uses them more and more in later examples. 

Do your students have problems with debugging? Your students won't have as much trouble with Chang: Chang introduces methods of debugging early in the book, and adds hints about debugging throughout.  The author also introduces techniques and modules illustrating better debugging information for CGI programs. 

Does your current Perl text just drop CGI into the book as a stand-alone chapter with no integration of CGI and Perl?

Chang introduces CGI examples early and integrates them throughout. Frequent examples facilitate understanding the constraints of programming applications that depend on the stateless HTTP protocol.  (Some examples show both command line-programs and CGI scripts, highlighting attention to the differences between them.) 

Chang is a teaching tool. Chang is probably your next Perl textbook. Order an exam copy and see for yourself.

Reviewer's Comments

Michael Hennessy, U. of Oregon
I use two web applications in my course, and both of these are dealt with in the book. This alone would make the book worthwhile for my course.

Mukkai Krishnamoorthy, Rensselaer Polytechnic Institute
I like the chapters, the writing style and the examples. The main thing I like is their detailed treatment.

Robert Kline, West Chester University
My current texts really don't do what I want. This book is definitely better.

Ijaz A. Awan, Savannah State U.
I have found many students get frustrated when CGI scripts don't work. This text seems to provide good information on the hows, whys, and what-fors using sample programs for execution.

Tim Downey, Florida International U.
The text and examples flowed well together. All concepts had an example to show their implementation or effect. The examples are complete and show the power of the applications. 

Steven Heckler, Accelebrate
The Author's commitment to a very hands-on approach is excellent—this is definitely how Perl must be taught.

The way that scope is explained is among the best descriptions I've read—I got several ideas for how I'm going to explain this in my Perl classes in the future.

Craig Berry, Software Developer
I like the idea of building from working app to working app as increasingly complex topics are covered; I find having a real example to experiment with really helps with learning.

I particularly approve of the use of (and encouragement for others to use) warnings, strict, CGI::Carp, and so forth.

Greg Johnson, U. of Missouri
The examples are interesting, of practical value, and not so involved as to frustrate beginners.

Table of Contents


Chapter 1 Introduction—Developing Interactive Web Applications
1.1 A Brief Look at The Internet and the World Wide Web
1.2 The HTTP Protocol
1.3 The Common Gateway Interface
1.4 An Example CGI Application
1.5 Programming Language Options
1.6 The Development Environment
1.7 HTML Forms
1.8 Programming Practices and Pitfalls
1.9 Summary
1.10 Exercises

Chapter 2—Basics of Perl and CGI Scripting
2.1 Starting a Perl Program
2.2 Working with Scalars
2.3 Interpolation in Strings
2.4 Standard Input and Standard Output
2.5 Returning CGI Documents
2.6 Getting Input—the QUERY_STRING Environment Variable
2.7 Asking Perl to Help You Find Problems: Warnings
2.8 Branching: Conditional Expressions and Operators
2.9 A First Look at Arrays and Hashes 
2.10 More About Operators
2.11 Looping: Repetition Control Structures
2.12 Programming Practices and Pitfalls
2.13 Summary
2.14 Exercises

Chapter 3—Working with Forms, Patterns, and Files
3.1 Pattern Matching; Translating Form Data
3.2 Environment Variables and Request methods
3.3 A First Look at Files
3.4 Programming Practices and Pitfalls
3.5 Summary
3.6 Exercises

Chapter 4—Subroutines and Functions
4.1 Defining Subroutines
4.2 Arguments and Return Values
4.3 Variable Scope: my() and local()
4.4 A First Look at References
4.5 Building Libraries of Subroutines
4.6 Creating Versatile Programs: Packages and Modules
4.7 Creating Robust Applications: Using Standard Modules
4.8 Example: Site Maintenance
4.9 Programming Practices and Pitfalls
4.10 Summary
4.11 Exercises

Chapter 5—Files and Directories
5.1 Ways of Reading from Files
5.2 Designating a File as the Default
5.3 Operations on Files: Deleting, Renaming and Changing Permissions
5.4 File Test Operators
5.5 Standard Files
5.6 Example: A Simple Counter
5.7 Anonymous Filehandles; Passing Filehandles to Subroutines
5.8 File Locking Using flock()
5.9 File Locking Continued—Creating a Separate Lockfile
5.10 Working with Directories
5.11 Example: Search and Replace
5.12 Data Storage—DBM Databases and Hashes
5.13 Interacting with Other Programs
5.14 Example: Sending Mail with sendmail
5.15 Security Issues
5.16 Programming Practices and Pitfalls
5.17 Summary
5.18 Exercises

Chapter 6—A Closer Look
6.1 The Importance of Context
6.2 More About Strings
6.3 Looking into Data Structures with Data::Dumper
6.4 More About Arrays
6.5 Transforming a List with map()
6.7 Selecting Elements from a List with grep()
6.8 Sorting Lists with sort()
6.8 More About Hashes
6.9 Programming Practices and Pitfalls
6.10 Summary
6.11 Exercises

Chapter 7 Powerful Perl—References and Regular Expressions
7.1 Using References to Create Complex Data Structures
7.2 Example: XBM format graphics
7.3 Subroutine References and Dispatch Tables
7.4 Perl's Regular Expression Engine
7.5 Constructing Regular Expressions
7.6 Programming Practices and Pitfalls
7.7 Summary
7.8 Exercises

Chapter 8—Extending Perl with Modules
8.1 CPAN, the Comprehensive Perl Archive Network
8.2 Objects in Perl
8.3 Using for Parsing and Creating Forms
8.4 Uploading Files Using
8.5 Separating Design and Code: HTML::Template
8.6 Example: Putting it All Together
8.7 Sending Mail
8.8 Programming Practices and Pitfalls
8.9 Summary
8.10 Exercises

Chapter 9—Creating Persistent State Information
9.1 Trying to Preserve Information Status Under a Stateless Protocol 
9.2 Hidden Variables
9.3 Session Files
9.4 Query and Extra Path Information
9.5 Persistent Client-side Cookies
9.6 Using CGI::SecureState
9.7 Example: Sadie's Shopping Cart
9.8 Programming Practices and Pitfalls
9.9 Summary
9.10 Exercises

Chapter 10—Data Management
10.1 Some Database Terminology
10.2 Delimited Text Files as Databases
10.3 SQL: the Structured Query Language
10.4 Interfacing with SQL Databases: The DBI and DBD modules
10.5 Example: Creating Sadie's Mailing List with DBD::CSV 
10.6 Using the MySQL Database with DBD::mysql
10.7 Maintaining State with Apache::Session
10.8 Example: Building a Document Repository
10.9 Programming Practices and Pitfalls
10.10 Summary
10.11 Exercises

Chapter 11—WWW Access with LWP
11.1 libwww-perl
11.2 The LWP::Simple Module
11.3 The LWP Model: HTTP Style Communication
11.4 Web Robots
11.5 The HTTP::Daemon Module
11.6 References
11.7 Summary
11.8 Exercises

Chapter 12—On-the-fly Graphics with GD
12.1 The Module
12.2 Polygons
12.3 Characters and Strings
12.4 Example: Drawing a Bar Chart
12.5 Working with an Existing Image
12.6 Copying Portions of Images
12.7 The GD::Graph Module
12.8 References
12.9 Summary
12.10 Exercises

Chapter 13—Security
13.1 What Can Go Wrong?
13.2 Don't Trust User Input
13.3 Directory Organization
13.4 File and Directory Permissions
13.5 Defensive Programming
13.6 Tainting
13.7 Using Encryption to Protect Data
13.8 References
13.9 Summary
13.10 Exercises

A Setting up a Practice Site Under Windows
B A Few Unix Commands
C Server Side Includes
D Quick Reference: HTML Form Elements
E Quick Reference: Perl Functions
F Quick Reference: Perl Special Constants, Filehandles, and Variables
G Quick Reference: Symbols used in Perl Regular Expressions

Companion Web Site

  • Source code for all the example programs in the book

  • Links to online Perl and CGI resources, including download sites for  software

  • A list of known errors and their corrections

  • A FAQ (Frequently Asked Questions) list

Practical Perl with CGI Applications by Elizabeth Chang
626 pages
ISBN 1-57676-112-6

Top of Page

Home | Textbook Catalog | Order Book | Syllabi

Scott/Jones Inc., El Granada CA
Website maintenance & updating by
Jane Scott/Jones.
January 16, 2004