Home > Store

Perl How to Program

Register your product to gain access to bonus material or receive a coupon.

Perl How to Program


  • Sorry, this book is no longer in print.
Not for Sale



  • Signature “Live Code Approach”—Language features are presented in the context of a wide variety of complete working programs. Features thousands of lines of code in hundreds of complete working programs.
    • Enables readers to confirm that programs run as expected. Readers can also manipulate the code from the CD-ROM in the back of the book or from the book's Companion Website (www.prenhall.com/deitel).

  • Web-based multi-tier applications.
    • Students learn from these applications and use them as a reference for real-world applications.

  • Outstanding, consistent and applied pedagogy—Icons throughout identify Software Engineering Observations; Good Programming Practices; Common Programming Errors; Portability Tips; Performance, Testing and Debugging tips.
    • Provides hundreds of valuable programming tips and facilitates learning.

  • Extensive set of interesting exercises and substantial projects.
    • Students can apply what they've learned in each chapter.

  • Complete chapter on web-accessibility.
    • Addresses programming and technologies relevant to accessibility for the disabled.


  • Copyright 2001
  • Dimensions: 7" x 9-1/8"
  • Pages: 1057
  • Edition: 1st
  • Book
  • ISBN-10: 0-13-028418-1
  • ISBN-13: 978-0-13-028418-1

This new book by the world's leading programming language textbook authors carefully explains how to use Perl as a general-purpose programming language and how to program multi-tier, client/server, database-intensive, Internet-and-Web-based applications.

Dr. Harvey M. Deitel and Paul J. Deitel are the principals of Deitel & Associates, Inc., the internationally recognized corporate training and content-creation organization specializing in C++, Java™, C#, C, Visual Basic®, XML™, Python, Perl, Internet, World Wide Web and object technologies. The Deitels are also the authors of the world's #1 Java and C++ textbooks, Java How to Program, 3/e and C++ How to Program, 3/e.

In Perl How to Program, the Deitels and their colleagues, Tem R. Nieto and David C. McPhie, discuss topics you need to build complete, Web-based applications including:

  • CGI/HTML forms/XML/CGI.pm
  • Control Structures/Arrays/Hashes
  • Regular Expressions/Strings
  • Objects/Encapsulation
  • OOP/Inheritance/References
  • Database/DBI/SQL/Signals/Contexts
  • Security/Accessibility
  • Typeglobs/File Globbing
  • Networking/Sockts/Internet Protocols
  • Cookies/Session Tracking
  • Filehandles/Data Structures
  • Process Control/Forking/Piping
  • Subroutines/Modules/Packages/Overloading
  • Web Automation/OLE Automation
  • Server-Side Includes/Ties/Closures
  • Graphics/GUI/Perl/TK

Perl How to Program includes extensive pedagogic features:

  • Hundreds of LIVE-CODE™ programs with screen captures that show exact outputs
  • Extensive World Wide Web and Internet resources to encourage further research
  • Hundreds of tips, recommended practices and cautions—all marked with icons

Sample Content

Table of Contents

(NOTE: Each chapter begins with Objectives, an Outline, and an Introduction and ends with a Summary, Terminology, a summary of all the programming tips in the chapter, Self-Review Exercises, Self-Review Exercise Answers, and Exercises.)

 1. Introduction to Computers, the Internet and the World Wide Web.

 2. Introduction to Programming in Perl.

 3. Control Structures: Part I.

 4. Arrays and Hashes.

 5. Control Structures: Part II.

 6. Subroutines and Functions.

 7. Introduction to the Common Gateway Interface (CGI).

 8. Regular Expressions.

 9. String Manipulation.

10. File Processing.

11. File and Directory Manipulation.

12. Formatted Output.

13. References.

14. Objects.

15. Perl Database Interface (DBI).

16. Session Tracking and Cookies.

17. Web Automation and Networking.

18. Process Control.

19. Security.

20. Complex Data Structures.

21. Graphics and Perl/Tk.

22. Perl and XML: A Web-Based Message Forums Application.

23. Accessibility: Developing for the Disabled.

24. Bonus Chapter: Introduction to HyperText Markup Language 4: Part I.

25. Bonus Chapter: Introduction to HyperText Markup Language 4: Part II.

26. Bonus Chapter: Introduction to Python Programming.

Appendix A: HTML Special Characters.

Appendix B: HTML Colors.

Appendix C: ASCII Character Set.

Appendix D: Operator Precedence Charts.

Appendix E: Number Systems.

Appendix F: Installing Apache Web Server.

Appendix G: Installing Perl.

Appendix H: Installing Python.

Appendix I: Career Resources.

Appendix J: Registering an ODBC Data Source.



Welcome to Perl! This book is by an old guy and three young guys. The old guy (HMD; Massachusetts Institute of Technology 1967) has been programming and/or teaching programming for 40 years. The three young guys (PJD; MIT 1991, TRN; MIT 1992 and DCM Harvard 2000) have each been programming and/or teaching programming for many years. The old guy programs and teaches from experience; the young guys do so from an inexhaustible reserve of energy. The old guy wants clarity; the young guys want performance. The old guy seeks elegance and beauty; the young guys want results. We got together to produce a book we hope you will find informative, challenging and entertaining.

Why We Wrote Perl How to Program

Dr. Harvey M. Deitel taught introductory programming courses in universities for 20 years with an emphasis on developing clearly written, well-designed programs. Much of what is taught in these courses is the basic principles of programming with an emphasis on the effective use of data types, control structures, arrays and functionalization. Our experience has been that students handle the material in this book in about the same manner as they handle it in introductory Pascal or C courses. There is one noticeable difference though: students are highly motivated by the fact that they are learning a leading-edge programming language and a leading-edge programming paradigm (object-based programming) that will be immediately useful to them as they leave the university environment and head into a world of e-business and e-commerce in which the Internet and the World Wide Web have a massive prominence.

Our goal was clear: produce a textbook for introductory university-level courses in programming for students with little or no programming experience, yet offer the depth and the rigorous treatment of theory and practice demanded by traditional, upper-level programming courses to satisfy professionals' needs. To meet this goal, we produced a comprehensive book that patiently teaches the principles of control structures, object-based programming and Internet and World Wide Web programming in Perl. After mastering the material in this book, students will be well prepared to take advantage of the Internet and the Web as they take upper-level courses and venture into the rapidly changing business world.

Perl How to Program is the ninth book in the Deitel/Prentice Hall How to Program series. The key focus of this book is Web-based applications development. Our audiences want to build real-world, industrial-strength, Web-based applications. These audiences care about good looking Web pages. But they also care about client/server systems, databases and distributed computing.

Many books about the Web are reference manuals with exhaustive listings of features. That is not our style. We concentrate on creating real applications. We provide the live-code examples on the CD accompanying this book so that you can run the applications and see the outputs.

We are excited about the enormous range of possibilities the Internet and the Web offer. We performed extensive research for this book and located many Internet and Web resources (which we provide as live links on the CD-ROM that accompanies this book) to help you learn about Perl. These links include general information, tutorials and demonstrations.

We have worked hard to create hundreds of useful live-code examples to help you master Perl programming quickly and effectively. All of the code examples are on the accompanying disk and are available for free download from our Web sites:

  • www.deitel.com
  • www.prenhall.com/deitel

The book's exercises range from simple recall questions to lengthy programming problems to major projects. Instructors requiring substantial term projects will find many appropriate problems listed in the exercises, especially in the later chapters. We have put a great deal of effort into the exercises to enhance the value of this book.

Teaching Approach

Perl How to Program contains a rich collection of examples and exercises that provide the student with a chance to solve interesting real-world problems. The book concentrates on the principles of good software engineering and stresses program clarity. We avoid arcane terminology and syntax specifications in favor of teaching by example. The book is written by educators who spend most of their time writing about and teaching edge-of-the-practice programming topics in industry classrooms worldwide for Deitel & Associates, Inc. The text emphasizes good pedagogy.

Live-CodeTM Teaching Approach
The book is loaded with hundreds of live-code examples. This is the focus of the way we teach and write about programming, and the focus of each of our multimedia Cyber Classrooms as well. Each new concept is presented in the context of a complete, working program immediately followed by one or more windows showing the program's input/output dialog. We call this style of teaching and writing our live-code approach. We use complete, working programs to teach programming languages. Reading these programs is much like entering and running them on a computer.

Perl How to Program explains cutting-edge technologies for building powerful Web-based applications. There is great stuff to be done in Perl, so let's get right to it! Web programming is not trivial by any means, but it is fun and students can see immediate results. Students can get graphical, database-intensive, network-based programs running quickly through "reusable components." They can implement impressive projects. They can be incredibly creative and productive in a one- or two-semester courses.

World Wide Web Access
All of the code for Perl How to Program (and our other publications) is on the CD that accompanies the book and on the Internet free for download at www.deitel.com and www.prenhall.com/deitel. Please run each program as you read the text. Make changes to the code examples and examine the effects of those changes. This is a great way to learn programming. Note: You must respect the fact that these programs are copyrighted material. Feel free to use them as you study, but you may not republish any portion of them in any form without explicit permission from Prentice Hall and the authors.

Each chapter begins with a statement of objectives. This tells the student what to expect and gives the student an opportunity, after reading the chapter, to determine if they have met these objectives. It is a confidence builder and a source of positive reinforcement.

The learning objectives are followed by a series of quotations. Some are humorous, some are philosophical and some offer interesting insights. Our students enjoy relating the quotations to the chapter material. You may appreciate some of the quotations more after reading the chapters.

The chapter outline helps the student approach the material in top-down fashion. This, too, helps students anticipate what is to come and set a comfortable and effective learning pace.

Each chapter is organized into small sections that address key Perl topics.

12922 Lines of Syntax-Highlighted Code in 271 Example Programs (with Outputs) We present Perl features in the context of complete, working programs; each program is immediately followed by a window containing the outputs produced when the program is run—we call this our live-code approach. This enables the student to confirm that the programs run as expected. Relating outputs back to the program statements that produce those outputs is an excellent way to learn and to reinforce concepts. Our programs exercise the diverse features of Pert. Reading the book carefully is much like entering and running these programs on a computer. The code is "syntax highlighted" with keywords appearing in the second color of the book, comments appearing in a lighter shade of that color and the rest of each program appearing in black. This makes it much easier to read the code—students will especially appreciate the syntax highlighting when they read the many more substantial programs we present.

An abundance of colorized charts and line drawings is included. The discussions of control structures in Chapters 3 through 5 feature carefully drawn flowcharts. Note: We do not teach the use of flowcharting as a program development tool, but we do use a brief flowchart-oriented presentation to specify the precise operation of Perl's control structures. Chapter 20, "Data Structures," uses line drawings to illustrate the creation and maintenance of linked lists, queues, stacks and binary trees. The remainder of the book is abundantly illustrated.

324 Programming Tips
We have included seven design elements to help students focus on important aspects of program development, testing and debugging, performance and portability. We highlight hundreds of these tips in the form of Good Programming Practices, Common Programming Errors, Look-and-Feel Observations, Performance Tips, Portability Tips, Software Engineering Observations and Testing and Debugging Tips. These tips and practices represent the best we have been able to glean from almost six decades (combined) of programming and teaching experience. One of our students—a mathematics major—told us recently that she feels this approach is somewhat like the highlighting of axioms, theorems and corollaries in mathematics books; it provides a basis on which to build good software.

  • 72 Good Programming Practices
    Good Programming Practices are highlighted in the text. They call the student's attention to ~ techniques that help produce better programs. When we teach introductory courses to nonprogrammers, we state that the "buzzword" of each course is "clarity," and we tell the students that we will highlight (in these Good Programming Practices) techniques for writing programs that are clearer, more understandable and more maintainable.
  • 107 Common Programming Errors
    Students learning a language-especially in their first programming course-tend to make certain kinds of errors frequently. Focusing on these Common Programming Errors helps students avoid making the same errors. It also helps reduce long lines outside instructors' offices during office hours!
  • 32 Performance Tips
    In our experience, teaching students to write clear and understandable programs is by far the most important goal for a first programming course. But students want to write the programs that run the fastest, use the least memory, require the smallest number of keystrokes, or dazzle in other nifty ways. Students really care about performance. They want to know what they can do to "turbo charge" their programs. So we have included Performance Tips to highlight opportunities for improving program performance.
  • 18 Portability Tips
    Software development is a complex and expensive activity. Organizations that develop software must often produce versions customized to a variety of computers and operating systems. So there is a strong emphasis today on portability, i.e., on producing software that will run on a variety of computer systems with few, if any, changes.
  • 66 Software Engineering Observations
    The Software Engineering Observations highlight techniques, architectural issues and design 'issues, etc. that affect the architecture and construction of software systems, especially large-scale systems. Much of what the student learns here will be useful in upper-level courses and in industry as the student begins to work with large, complex real-world systems.
  • 24 Testing and Debugging Tips
    This "tip type" may be misnamed. When we decided to incorporate Testing and Debugging Tips into this book, we thought these tips would be suggestions for testing programs to expose bugs and suggestions for removing those bugs. In fact, most of these tips tend to be observations about capabilities and features of Perl that prevent bugs from getting into programs in the first place.
  • 5 Look-and-Feel Observations
    We provide Look-and-Feel Observations to highlight graphical user interface conventions. These observations help students design their own graphical user interfaces to conform with industry norms.

Each chapter ends with additional pedagogical devices. We present an extensive, bullet-list-style Summary in every chapter. This helps the student review and reinforce key concepts. There is an average of 48 summary bullets per chapter.

We include a Terminology section with an alphabetized list of the important terms defined in the chapter—again, further reinforcement. There is an average of 84 terms per chapter.

614 Self-Review Exercises and Answers (Count Includes Separate Parts)
Extensive Self-Review Exercises and Answers to Self-Review Exercises are included for self study. This gives the student a chance to build confidence with the material and prepare to attempt the regular exercises.

210 Exercises (Count Includes Separate Parts)
Each chapter concludes with a set of exercises including simple recall of important terminology and concepts, writing individual program statements, writing small portions of functions and writing complete functions and programs. The large number of exercises enables instructors to tailor their courses to the unique needs of their audiences and to vary course assignments each semester. Instructors can use these exercises to form homework assignments, short quizzes and major examinations.

Instructor's Manual with Solutions to the Exercises
The solutions for the exercises are included on the Instructor's Resource CD and are available only to instructors through their Prentice Hall representatives. NOTE: Please do not write to us requesting the instructor's manual. Distribution of this publication is strictly limited to college professors teaching from the book. Instructors may obtain the solutions manual only from their regular Prentice Hall representatives. We regret that we cannot provide the solutions to professionals.

3500 Index Entries (Total of 4800 Counting Multiple References)
We have included an extensive Index at the back of the book. This helps the student find any term or concept by keyword. The Index is useful to people reading the book for the first time and is especially useful to practicing programmers who use the book as a reference. Most of the terms in the Terminology sections appear in the Index (along with many more index items from each chapter). Thus, the student can use the Index in conjunction with the Terminology sections to be sure they have covered the key material of each chapter.

An extensive bibliography of books, articles and online documentation is included to encourage further reading.

Software Included with Perl How to Program

The CD-ROM at the end of this book contains a variety of software, including ActiveState ActivePerl 5.6. Perl 5.6.0, MySQL 3.223.x and Apache 1.3.12. The CD also contains the book's code examples and an HTML Web page with links to the Deitel & Associates, Inc. Web site, the Prentice Hall Web site and the many Web sites listed in the web resources section of the chapters. If you have access to the internet, the Web page on the CD can be loaded into your World Wide Web browser to give you quick access to all the resources.

If you have any questions about using this software, please read all the introductory documentation on the CD-ROM. Additional information is available at our Web site: www.deitel.com NOTE: We do not provide technical support for the software application programs. However, if you have any technical questions about the installation of the CD, please e-mail media.support@pearsoned.com. They will respond promptly.

Perl How to Program Ancillary Package

We have worked hard to produce a textbook and ancillaries that we hope instructors and students will find valuable. We would like to thank ActiveState, Apache and MySQL AB for providing the products included on the CD-ROM in the back of this textbook. The following ancillary resources are available.

  • Perl How to Program's 271 program examples are included in the back of the textbook are also available for download at www.deitel.com and www.prenhall.com/deitel. The helps instructors prepare lectures faster and helps students master Perl. When extracting the source code from the ZIP file, you must use a ZIP-file reader such as WinZip (www.winzip.com) or PKZIP (www.pkware.com) that understands directories. The file should be extracted into a separate directory (e.g. perlhtpl_examples). Students should execute each program they study in the text.
  • The Instructor's Manual on CD contains answers to most of the exercises in the textbook. The programs are separated into directories by chapter and exercise number. NOTE: Please do not write to us requesting the instructor's manual. Distribution of this publication is strictly limited to college professors teaching from the book. Instructors may obtain the Instructor's Manual only from their regular Prentice Hall representatives. We regret that we cannot provide the solutions to professionals.
  • Companion Web Site (www.prehhall.com/deitel) provides instructor and student resources. Instructor resources include textbook appendices and a syllabus manager for lesson planning. Student resources include chapter objectives, true/false review questions with answers, chapter highlights, reference materials and a message board.
  • Customizable PowerPoint® Instructor Lecture Notes , including source code and key discussion points for each program and major illustration. These lecture notes are available for instructors and students at no charge at our www.deitel.com Web site. Although instructors may modify these notes and use them in class presentations, please be aware that these notes are copyrighted by Prentice Hall and may not be used without the express written permission of Prentice Hall.
  • Deitel & Associates, Inc. Web site (www.deitel.com) provides a variety of resources, including various installation instructions for the software used in this book and the examples from the book. Please visit this site to keep apprised of the latest Deitel & Associates, Inc. publications and news.

Perl Multimedia Cyber Classroom and The Complete Pert Training Course

We have prepared an optional interactive, CD-ROM-based, software version of Perl How to Program called the Perl Multimedia Cyber Classroom. It is loaded with features for learning and reference. The Cyber Classroom is wrapped with the textbook at a discount in The Complete Perl Training Course. If you already have the book and would like to purchase the Perl Multimedia Cyber Classroom separately, please call 1-800-811-0912 and ask for ISBN# 0-13-089553-9.

The CD has an introduction with the authors overviewing the Cyber Classroom's features. The live-code examples in the textbook truly "come alive" in the Cyber Classroom. With many of the examples, you can simply click the lightning bolt icon and the program will be executed. You will immediately see the program's outputs. If you want to modify a program and see the effects of your changes, simply click the floppy-disk icon that causes the source code to be "lifted off' the CD and "dropped into" one of your own directories so that you can edit the program and try out your new version. Click the speaker icon for an audio that talks about the program and walks you through the code.

The Cyber Classroom also provides navigational aids including extensive hyperlinking. The Cyber Classroom remembers in a "history list" recent sections you have visited and allows you to move forward or backward in that history list. The thousands of index entries are hyperlinked to their text occurrences. You can key in a term using the "find" feature and the Cyber Classroom will locate occurrences of that term throughout the text. The Table of Contents entries are "hot," so clicking a chapter name takes you to that chapter.

Students like the solved problems from the textbook that are included with the Cyber Classroom. Studying and running these extra programs is a nice way for students to enhance their learning experience.

Students and professional users of our Cyber Classrooms tell us they like the interactivity and that the Cyber Classroom is an effective reference because of the extensive hyperlinking and other navigational features. We recently had an e-mail from a person who said that he lives "in the boonies" and cannot take a live course at a university, so the Cyber Classroom was a good solution to his educational needs.

Professors tell us that their students enjoy using the Cyber Classroom, spend more time on the course and master more of the material than in textbook-only courses. Also, the Cyber Classroom helps shrink line, outside professors' offices during office hours. We have also published the C++ Multimedia Cyber Classroom (3/e), the Visual Basic 6 Multimedia Cyber Classroom, the Java 2 Multimedia Cyber Classroom (3/e), the Internet and World Wide Web Programming Multimedia Cyber Classroom, e-Business and e-Commerce Multimedia Cyber Classroom and the XML Multimedia Cyber Classroom. Each of these Cyber Classrooms is available in a Complete Training Course boxed product that contains the corresponding How to Program Series textbook.


Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership