Home > Store

Perl by Example, 4th Edition

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

Perl by Example, 4th Edition

Book

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

Description

  • Copyright 2008
  • Dimensions: 7" x 9-1/4"
  • Pages: 1008
  • Edition: 4th
  • Book
  • ISBN-10: 0-13-238182-6
  • ISBN-13: 978-0-13-238182-6

“I picked up a copy of JavaScript by Example over the weekend and wanted to thank you for putting out a book that makes JavaScript easy to understand. I’ve been a developer for several years now and JS has always been the “monster under the bed,” so to speak. Your book has answered a lot of questions I’ve had about the inner workings of JS but was afraid to ask. Now all I need is a book that covers Ajax and Coldfusion. Thanks again for putting together an outstanding book.”

Chris Gomez, Web services manager, Zunch Worldwide, Inc.


“I have been reading your UNIX® Shells by Example book, and I must say, it is brilliant. Most other books do not cover all the shells, and when you have to constantly work in an organization that uses tcsh, bash, and korn, it can become very difficult. However, your book has been indispensable to me in learning the various shells and the differences between them…so I thought I’d email you, just to let you know what a great job you have done!”

Farogh-Ahmed Usmani, B.Sc. (Honors), M.Sc., DIC, project consultant (Billing Solutions), Comverse


“I have been learning Perl for about two months now; I have a little shell scripting experience but that is it. I first started with Learning Perl by O’Reilly. Good book but lacking on the examples. I then went to Programming Perl by Larry Wall, a great book for intermediate to advanced, didn’t help me much beginning Perl. I then picked up Perl by Example, Third Edition–this book is a superb, well-written programming book. I have read many computer books and this definitely ranks in the top two, in my opinion. The examples are excellent. The author shows you the code, the output of each line, and then explains each line in every example.”

Dan Patterson, software engineer, GuideWorks, LLC


“Ellie Quigley has written an outstanding introduction to Perl, which I used to learn the language from scratch. All one has to do is work through her examples, putz around with them, and before long, you’re relatively proficient at using the language. Even though I’ve graduated to using Programming Perl by Wall et al., I still find Quigley’s book a most useful reference.”

Casey Machula, support systems analyst, Northern Arizona University, College of Health and Human Services


“When I look at my bookshelf, I see eleven books on Perl programming. Perl by Example, Third Edition, isn’t on the shelf; it sits on my desk, where I use it almost daily. When I bought my copy I had not programmed in several years and my programming was mostly in COBOL so I was a rank beginner at Perl. I had at that time purchased several popular books on Perl but nothing that really put it together for me. I am still no pro, but my book has many dog-eared pages and each one is a lesson I have learned and will certainly remember. “I still think it is the best Perl book on the market for anyone from a beginner to a seasoned programmer using Perl almost daily.”

Bill Maples, network design tools and automations analyst, Fidelity National Information Services


“We are rewriting our intro to OS scripting course and selected your text for the course. It’s an exceptional book. The last time we considered it was a few years ago (second edition). The debugging and system administrator chapters at the end nailed it for us.”

Jim Leone, Ph.D., professor and chair, Information Technology, Rochester Institute of Technology


“Quigley’s book acknowledges a major usage of PHP. To write some kind of front end user interface program that hooks to a back end MySQL database. Both are free and open source, and the combination has proved popular. Especially where the front end involves making an HTML web page with embedded PHP commands. “Not every example involves both PHP and MySQL. Though all examples have PHP. Many demonstrate how to use PHP inside an HTML file. Like writing user-defined functions, or nesting functions. Or making or using function libraries. The functions are a key idea in PHP, that take you beyond the elementary syntax. Functions also let you gainfully use code by other PHP programmers. Important if you are part of a coding group that has to divide up the programming effort in some manner.”

Dr. Wes Boudville, CTO, Metaswarm Inc.


The World’s Easiest Perl Tutorial–Fully Updated!


Perl by Example, Fourth Edition, is the easiest, most hands-on way to learn Perl. Legendary Silicon Valley programming instructor Ellie Quigley has thoroughly updated her classic to deliver the skills and information today’s Perl users need most–including all-new coverage of MySQL database programming and a Perl QuickStart designed to get experienced users up and running fast.


Quigley illuminates every technique with focused, classroom-tested code examples, detailed line-by-line explanations, and real program output. This exceptionally clear, easy-to-understand book takes you from your first Perl script to database-driven applications. It’s the only Perl book you’ll ever need!


New in this edition:

  • Perl programming QuickStart: makes first-time Perl programmers productive in just twenty pages

  • All-new chapter on using the Perl DBI with the MySQL database–plus an easy SQL primer to quickly get you started programming any database

  • New introductions to Perl in biology (bioinformatics) and to mod_perl, a Perl interpreter embedded in the Apache server, which allows you to create fast, dynamic content; manage the Apache server; authenticate users; and much more

Completely updated:

  • Includes many new and completely rewritten code examples

  • Contains fully revised CGI coverage for building dynamic Web sites with Perl

  • Covers modern Perl 5.8 concepts and principles–and provides a great foundation for Perl 6

More than 30,000 sysadmins, power users, and developers have used previous editions of Perl by Example

to become expert Perl programmers. With Perl by Example, Fourth Edition, you can, too–even if you’re

completely new to Perl. After you’ve become an expert, you’ll turn to this book constantly as the best

source for reliable answers, solutions, and code.


About the CD-ROM:

The CD-ROM includes all code and files for this book’s hundreds of example scripts.

Sample Content

Online Sample Chapter

Regular Expressions in Perl—Pattern Matching

Table of Contents

Preface xxvii

Chapter 1: The Practical Extraction and Report Language 1

1.1 What Is Perl? 1

1.2 What Is an Interpreted Language? 2

1.3 Who Uses Perl? 3

1.4 Where to Get Perl 5

1.5 What Is CPAN? 9

1.6 Perl Documentation 10

1.7 What You Should Know 12

1.8 What’s Next? 12

Chapter 2: Perl Quick Start 13

2.1 Quick Start, Quick Reference 13

2.2 Chapter Summary 29

2.3 What’s Next? 29

Chapter 3: Perl Scripts 31

3.1 Script Setup 31

3.2 The Script 32

3.3 Perl at the Command Line 39

3.4 What You Should Know 43

3.5 What’s Next? 43

Chapter 4: Getting a Handle on Printing 45

4.1 The Filehandle 45

4.2 Words 45

4.3 The print Function 46

4.4 The printf Function 59

4.5 What You Should Know 66

4.6 What’s Next? 66

Chapter 5: What’s in a Name 69

5.1 About Perl Variables 69

5.2 Scalars, Arrays, and Hashes 77

5.3 Reading from STDIN 94

5.4 Array Functions 100

5.5 Hash (Associative Array) Functions 118

5.6 More Hashes 128

5.7 What You Should Know 132

5.8 What’s Next? 133

Chapter 6: Where’s the Operator? 137

6.1 About Perl Operators 137

6.2 Mixing Data Types 138

6.3 Precedence and Associativity 139

6.4 What You Should Know 168

6.5 What’s Next? 168

Chapter 7: If Only, Unconditionally, Forever 171

7.1 Control Structures, Blocks, and Compound Statements 171

7.2 Repetition with Loops 177

7.3 What You Should Know 200

7.4 What’s Next? 200

Chapter 8: Regular Expressions–Pattern Matching 203

8.1 What Is a Regular Expression? 203

8.2 Expression Modifiers and Simple Statements 204

8.3 Regular Expression Operators 210

8.4 What You Should Know 232

8.5 What’s Next? 232

Chapter 9: Getting Control–Regular Expression Metacharacters 235

9.1 Regular Expression Metacharacters 235

9.2 Unicode 281

9.3 What You Should Know 283

9.4 What’s Next? 283

Chapter 10: Getting a Handle on Files 285

10.1 The User-Defined Filehandle 285

10.2 Passing Arguments 310

10.3 File Testing 319

10.4 What You Should Know 321

10.5 What’s Next? 322

Chapter 11: How Do Subroutines Function? 325

11.1 Subroutines/Functions 325

11.2 Passing Arguments 330

11.3 Call-by-Reference 344

11.4 What You Should Know 358

11.5 What’s Next? 359

Chapter 12: Modularize It, Package It, and Send It to the Library! 363

12.1 Packages and Modules 363

12.2 The Standard Perl Library 370

12.3 Modules from CPAN 390

12.4 What You Should Know 398

12.5 What’s Next? 398

Chapter 13: Does This Job Require a Reference? 401

13.1 What Is a Reference? What Is a Pointer? 401

13.2 What You Should Know 420

13.3 What’s Next? 420

Chapter 14: Bless Those Things! (Object-Oriented Perl) 423

14.1 The OOP Paradigm 423

14.2 Classes, Objects, and Methods 425

14.3 Anonymous Subroutines, Closures, and Privacy 453

14.4 Inheritance 460

14.5 Public User Interface–Documenting Classes 474

14.6 Using Objects from the Perl Library 479

14.7 What You Should Know 484

14.8 What’s Next? 485

Chapter 15: Those Magic Ties and DBM Stuff 493

15.1 Tying Variables to a Class 493

15.2 DBM Files 505

15.3 What You Should Know 512

15.4 What’s Next? 512

Chapter 16: CGI and Perl: The Hyper Dynamic Duo 513

16.1 Static and Dynamic Web Pages 513

16.2 How It all Works 516

16.3 Creating a Web Page with HTML 522

16.4 How HTML and CGI Work Together 526

16.5 Getting Information Into and Out of the CGI Script 531

16.6 CGI and Forms 535

16.7 The CGI.pm Module 559

Chapter 17: Perl Meets MySQL–A Perfect Connection 603

17.1 Introduction 603

17.2 What Is a Relational Database? 604

17.3 Getting Started with MySQL 613

17.4 What Is the Perl DBI? 638

17.5 Statements that Don’t Return Anything 666

17.6 Transactions 670

17.7 Using CGI and the DBI to Select and Display Entries 672

17.8 What’s Left? 678

17.9 What You Should Know 679

17.10What’s Next? 679

Chapter 18: Interfacing with the System 685

18.1 System Calls 685

18.2 Processes 721

18.3 Other Ways to Interface with the Operating System 747

18.4 Error Handling 755

18.5 Signals 760

18.6 What You Should Know 764

18.7 What’s Next? 765

Chapter 19: Report Writing with Pictures 767

19.1 The Template 767

19.2 What You Should Know 783

19.3 What’s Next? 783

Chapter 20: Send It Over the Net and Sock It to ’Em! 785

20.1 Networking and Perl 785

20.2 Client /Server Model 785

20.3 Network Protocols (TCP/IP) 785

20.4 Network Addressing 787

20.5 Sockets 794

20.6 Client /Server Programs 800

20.7 The Socket.pm Module 808

20.8 What You Should Know 813

Appendix A: Perl Built-ins, Pragmas, Modules, and the Debugger 815

A.1 Perl Functions 815

A.2 Special Variables 845

A.3 Perl Pragmas 848

A.4 Perl Modules 850

A.5 Command-Line Switches 856

A.6 Debugger 858

Appendix B: SQL Language Tutorial 863

B.1 What Is SQL? 863

B.2 SQL Data Manipulation Language (DML) 871

B.3 SQL Data Definition Language 888

B.4 SQL Functions 901

B.5 Appendix Summary 910

B.6 What You Should Know 910

Appendix C: Perl and Biology 915

C.1 What Is Bioinformatics? 915

C.2 A Little Background on DNA 915

C.3 Some Perl Examples 917

C.4 What Is BioPerl? 919

C.5 Resources 923

Appendix D: Power and Speed: CGI and mod_perl 925

D.1 What Is mod_perl? 925

D.2 The mod_perl Web Site 927

D.3 Installing mod_perl 928

D.4 Resources 938

Index 939

Preface

Download the preface

Index

Download the index

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