This is a modified chapter of Mastering Perl by brian d foy and published by O'Reilly Media. It may differ significantly from that in the book due to corrections, additions of new material, or removal of obsolete material. This material is online for community review in preparation for a second edition.

This work is copyrighted under a contract between O'Reilly Media and brian d foy, and you cannot repost it or distribute it without permission.

Preface

Mastering Perl is the third book in the series starting with Learning Perl, which taught you the basics of Perl syntax, progressing to Intermediate Perl, which taught you how to create re-usable Perl software, and finally this book, which pulls everything together to show you how to bend Perl to your will. This isn't a collection of clever tricks, but a way of thinking about Perl programming so you integrate the real-life problems of debugging, maintenance, configuration, and other tasks you'll encounter as a working programmer. This book starts you on your path to becoming the person with the answers, and, failing that, the person who knows how to find the answers or discover the problem.

Structure of This Book

Conventions Used in This Book

The following typographic conventions are used in this book:

Using Code Examples

This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact O'Reilly for permission unless you're reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O'Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product's documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example, Mastering Perl, by brian d foy (ISBN 1-596-52724-1). Copyright 2007 O'Reilly Media, Inc.

If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at permissions@oreilly.com.

Comments and Questions

Please address comments and questions concerning this book to the publisher:


O'Reilly Media
1005 Gravenstein Highway North
Sebastopol, CA 95472
(800) 998-9938 (in the United States or Canada)
(707) 829-0515 (international/local)
(707) 829-0104 (fax)

The web page for this book, which lists errata, examples, or any additional information, can be found at:

Additionally, during the writing the author maintained a web site for this book where you can find additional information, including links to related resources and possible updates to the book:

To comment or ask technical questions about this book, send email to:

For more information about books, conferences, Resource Centers, and the O'Reilly Network, see the O'Reilly web site at:

Acknowledgments

From brian: Many people helped me during the year I took to write this book. The readers of the Mastering Perl mailing list gave constant feedback on the manuscript and sent patches, which I mostly applied as is, including those from Andy Armstrong, David H. Adler, Renée Baumlcker, Anthony R. J. Ball, Daniel Bosold, Alessio Bragadini, Philippe Bruhat, Katharine Farah, Shlomi Fish, David Golden, Bob Goolsby, Ask Bjørn Hansen, Jarkko Hietaniemi, Joseph Hourcle, Adrian Howard, Offer Kaye, Stefan Lidman, Eric Maki, Josh McAdams, Florian Merges, Jason Messmer, Thomas Nagel, Xavier Noria, Les Peters, Bill Riker, Yitzchak Scott-Thoennes, Ian Sealy, Sagar R. Shah, Alberto Simões, Derek B. Smith, Kurt Starsinic, Adam Turoff, David Westbrook, and Evan Zacks. I'm quite re-assured that their constant scrutiny kept me on the right path.

Tim Bunce provided gracious advice about the profiling chapter, which includes DBI::Profile, and Jeffrey Thalhammer updated me on the current developments with his Perl::Critic module.

Perrin Harkins, Rob Kinyon, and Randal Schwartz gave the manuscript a thorough beating at the end, and I'm glad I chose them as technical reviewers because their advice is always spot on.

Allison Randal provided valuable Perl advice and editorial guidance on the project, even though she probably dreaded my constant queries. Near the end of the year, Andy Oram took over as editor and helped me get the manuscript into shape so we could turn it into a book. The entire O'Reilly Media staff, from editorial, production, marketing, sales, and everyone else, was friendly and helpful, and it's always a pleasure to work with them. It takes much more than an author to create a book, so thank a random O'Reilly employee next time you see one.

Randal Schwartz, my partner at Stonehenge Consulting, warned me that writing a book was a lot of work and still let me mostly take the year off to do it. I started in Perl by reading his Learning Perl and am now quite pleased to be adding another book to the series. As Randal has told me many times "You'll get paid more at Starbucks and get health insurance too." Authors write to share their thoughts with the world, and we write to make other people better programmers.

Finally, I have to thank the Perl community, which has been incredibly kind and supportive over the ten years that I've been part of it. So many great programmers and managers helped me become a better programmer, and I hope this book does the same for people just joining the crowd.