Home > Store

Perl by Example, 3rd Edition

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

Perl by Example, 3rd Edition

Book

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

About

Features

  • NEW - CGI for Web development coverage expanded—Including CGI.pm and database integration with DBI.
    • Shows students how to program dynamic web sites. Ex.___

  • NEW - New exercises and examples in every chapter—Addressing UNIX, Linux, Windows (Win32), and Macintosh.
    • Provides students with examples in the new and improved pedagogical format introduced in the Second Edition. Ex.___

  • NEW - Revised and updated for Perl 5.6.0.
    • Provides students with the most current references to the latest software versions. Ex.___

  • NEW - MacPerl Mac and Windows NT installation.
    • Enables students with knowledge of either operating system to use the reference. Ex.___

  • Proven methodology and sample programs.
    • Provides students with a tried and true presentation of the subject. Ex.___

  • Basic to advanced programming.
    • Takes students from their first program to highly sophisticated Perl scripting. Ex.___

  • Tutorial and reference.
    • Provides students with step-by-step guidelines that they can refer back to in the future. Ex.___

  • Utilities substitute.
    • Shows students how Perl can be a convenient substitute for grep, awk, sed, tr, shells and C. Ex.___

  • Perl development—Names and operators, regular expression, file handles, libraries, references, reporting, scripting for complex networking and interprocess communications tasks.
    • Provides students with insight into every aspect of Perl. Ex.___

Description

  • Copyright 2002
  • Edition: 3rd
  • Book
  • ISBN-10: 0-13-028251-0
  • ISBN-13: 978-0-13-028251-4

The grand-daddy of all Perl guides-now updated for Perl on all key platforms.

  • All new edition of the classic hands-on guide to Perl
  • Extensive new coverage of CGI for Web development
  • Now with full cross-platform coverage, including Linux, UNIX, Windows NT, and Macintosh
  • Packed with examples, all on the enclosed CD-ROM, along with up-to-date Perl software for Windows users
  • Best-selling author Ellie Quigley is Silicon Valley's leading Perl instructor!

The Perl tutorial and reference that started it all is now available in a thoroughly revised edition that covers all flavors of Perl and all system and Web applications. Best-selling author Ellie Quigley combines her deep background and UNIX chops with up-to-the-minute experience teaching Perl and shell programming on all platforms. This translates into hands-on examples that all users can put straight to work whether scripting Web applications or managing networks.

Filled with practical information on Perl development, Perl by Example, Third Edition covers names and operators, regular expressions, file handles, libraries, references, reporting, and more.

Highlights include:

  • Support for Perl on Unix, Linux, Windows, and Macintosh
  • CGI Web development with CGI.pm
  • Database integration with Perl DBI

The user-friendly style offers one-to-one comparisons with other popular languages and utilities and a massive reference section for easy look-up. The hands-on tutorials are great for beginners, but also offer handy refreshers for experienced programmers looking to update their skills.

About the CD-ROM

The CD-ROM includes all source code from the book, plus new Perl distributions for Windows.

Sample Content

Table of Contents



Preface.


Acknowledgments.


1. The Practical Extraction and Report Language.

What Is Perl? Who Uses Perl? Which Perl? Where to Get Perl. What Is CPAN? Perl Documentation.



2. Perl Scripts.

Perl at the Command Line. Script Setup. The Script. Exercise 1: Getting with It Syntactically.



3. Getting a Handle on Printing.

The Filehandle. Words. The print Function. The printf Function. Exercise 2: A String of Perls.



4. What's in a Name.

About Perl Variables. Scalars, Arrays, and Hashes. Reading from STDIN. Array Functions. Hash (Associative Array) Functions. More Hashes. Exercise 3: The Funny Characters.



5. Where's the Operator?

About Perl Operators. Mixing Data Types. Precedence and Associativity. Exercise 4: Operator, Operator.



6. If Only, Unconditionally, Forever.

Control Structures, Blocks, and Compound Statements. Decision Making-Conditional Constructs. Loops. Exercise 5: What Are Your Conditions?



7. Regular Expressions-Pattern Matching.

What Is a Regular Expression? Expression Modifiers and Simple Statements. Regular Expression Operators. Exercise 6: Is it sed, awk, or grep? Give Perl a Whirl!



8. Getting Control-Regular Expression Metacharacters.

Regular Expression Metacharacters. Unicode. Exercise 7: Is it sed, awk, or grep? Give Perl Another Whirl!



9. Getting a Handle on Files.

The User-Defined Filehandle. Passing Arguments. File Testing. Exercise 8: Getting a Handle on Things.



10. How Do Subroutines Function?

Subroutines/Functions. Exercise 9: I Can't Seem to Function Without Subroutines.



11. Modularize It, Package It, and Send It to the Library!

Packages and Modules. The Standard Perl Library. Exercise 10: I Hid All My Perls in a Package. Exercise 11: Pack It up and Take It to the Library.



12. Does This Job Require a Reference?

What Is a Reference? Exercise 12: It's Not Polite to Point!



13. Bless Those Things! (Object-Oriented Perl)

The OOP Paradigm. Classes, Objects, and Methods. Inheritance. Public User Interface-Documenting Classes. Using Objects from the Perl Library. Exercise 13: What's the Object of This Lesson? Exercise 14: Perls in a Pod.



14. Those Magic Ties, DBM Stuff, and the Database Hooks.

Tying Variables to a Class. DBM Files.



15. Introduction to Perl Database Programming.

Chapter Overview. Perl Database Programming. Perl Programming with an RDBMS. Accessing MSS Using ADO and DBI. Accessing Oracle Using ADO and DBI. Exercises: Non-Programming. Exercise 15: Introduction to Using MSS. Exercise 16: Executing persons.sql in MSS. Exercise 17: Introduction to Using Oracle. Exercise 18: Executing persons.sql in Oracle. References.



16. Interfacing with the System.

System Calls. Processes. Other Ways to Interface with the Operating System. Error Handling. Signals.



17. Report Writing with Pictures.

The Template.



18. Send It Over the Net and Sock It To 'Em!

Networking and Perl. Client/Server Model. Network Protocols (TCP/IP). Network Addressing. Sockets. Client/Server Programs. The Socket.pm Module.



19. CGI and Perl: The Hyper Dynamic Duo.

What Is CGI? Internet Communication Between Client and Server. Creating a Web Page with HTML. How HTML and CGI Work Together. Log Files. Where to Find CGI Applications. Getting Information Into and Out of the CGI Script. Processing Forms with CGI. The CGI.pm Module. Exercise 19: Surfing for Perls. Exercise 20: Let's Use CGI.pm.



Appendix A: Perl Built-Ins, Pragmas, Modules, and the Debugger.

Perl Functions. Special Variables. Perl Pragmas. Perl Modules. Command Line Switches. Debugger.



Appendix B: Some Helpful Scripts.

taintperl Script by Mark Houser. maxpstat by John J. Nouveaux. randomize by John J. Nouveaux.



Appendix C: An Object-Oriented Perl/CGI Program.

The analyze.cgi Program and Associated Files.



Appendix D: HTML Documents: A Basic Introduction.

Intro to the Intro. What Is HTML? HTML Tags. The Minimal HTML Document. Character Formatting. Linking. Adding Comments. Case Sensitivity. Graphics and Images. Troubleshooting. Metatags, Cascading Style Sheets, and Java. Looking Behind the Scenes (or, What Did We Do Before the Right-Click?). What About Frames? Some Final Thoughts.



Index.

Preface

Preface

Last week, I was teaching Perl at the UCSC extension in Santa Clara, California to a group of professionals coming from all around the Bay Area. I always ask at the beginning of the class, "and so why do you want to learn Perl?". The responses vary from, "Our company has an auction site on the Web and I'm the webmaster. I need to maintain the CGI programs that process our orders, " or "I work in a genetics research group at Stanford and have to deal with tons of data . . . we're looking for the gene that causes arteriosclerosis . . . oh and I heard that if I learn Perl, I won't have to depend on programmers to do this," or "I work at a local bank and we use Perl to interface with our big Oracle databases," or "I'm a UNIX/NT system administrator and our boss has decided that all future admin scripts should be written in Perl," or "I'm designing a Web page for my wife who wants to do Taro card readings for profit," or "I just got laid off and heard that it's an absolute must to have Perl on my resume." And I am always amazed at the variety of people who show up: engineers, scientists, geneticists, meteorologists, managers, salespeople, programmers, techies, hardware guys, students, stockbrokers, administrators of all kinds, librarians, authors, bankers, artists-you name it. Perl does not exclude anyone. Perl is for everyone and it runs on everything.

No matter who you are, I think you'll agree, a picture is worth a thousand words, and so is a good example. Perl by Example is organized to teach you Perl from scratch with examples of complete succinct programs. Each line of a script example is numbered, and important lines are highlighted in bold. The output of the program is then displayed with line numbers corresponding to the script line numbers. Following the output is a separate explanation for each of the numbered lines. The examples are small and to the point for the topic at hand. Since the backbone of this book was used as a student guide to a Perl course, the topics are modularized. Each chapter builds on the previous one with a minimum of forward referencing and a logical progression from one topic to the next. There are exercises at the end of the chapters. You will find all of the examples on the CD at the back of the book. They have been thoroughly tested on a number of major platforms.

Perl by Example is not just a beginner's guide, but a complete guide to Perl. It covers many aspects of what Perl can do, from regular expression handling, to formatting reports, to interprocess communication. It will teach you about Perl and, in the process, a lot about UNIX and Windows. Since Perl was originally written on and for UNIX systems, some UNIX knowledge will greatly accelerate your learning path, but it is not assumed that you are by any means a guru. Anyone reading, writing, or just maintaining Perl programs can greatly profit from this text. Topics such as networking, system calls, IPC, and CGI are designed to save the time it takes to figure out how the functions work, what libraries are needed, the correct syntax, etc. This third edition also covers Perl objects, references, and CGI, as well as a new chapter to show you how to use the popular CGI.pm module by Lincoln Stein.

Perl has a rich variety of functions for handling strings, arrays, the system interface, networking, and more. In order to understand how these functions work, background information concerning the hows, whys, and what fors is provided before demonstrating functional sample programs. This eliminates constantly wading through manual pages and other books to understand what is going on, what the arguments mean, and what the function actually does.

The appendices contain a complete list of functions and definitions, command line switches, special variables, popular modules, the Perl debugger; a fully functional, object-oriented CGI program; some other helpful scripts; and a helpful HTML tutorial.

I have been teaching now for the past 30 years and am committed to understanding how people learn. Having taught Perl now for over eight years, all over the world, I find that many new Perlers get frustrated when trying to teach themselves how to program. I found that most people learn best from succinct little examples and practice. So I wrote a book to help myself learn and to help my students, and now to help you. As Perl has grown, so have my books. This latest third edition, includes information for those using Windows as well as different flavors of UNIX. In my book you will not only learn Perl, you will also save yourself a great deal of time. At least that's what my students and readers have told me. You be the judge.

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020