This is the third in O'Reilly's series of landmark Perl tutorials, which started with Learning Perl , the bestselling introduction that taught you the basics of Perl syntax, and Intermediate Perl , which taught you how to create re-usable Perl software. Mastering Perl pulls everything together to show you how to bend Perl to your will. It convey's Perl's special models and programming idioms. This book isn't a collection of clever tricks, but a way of thinking about Perl programming so you can integrate the real-life problems of debugging, maintenance, configuration, and other tasks you encounter as a working programmer. The book explains how to: Use advanced regular expressions, including global matches, lookarounds, readable regexes, and regex debugging Avoid common programing problems with secure programming techniques Profile and benchmark Perl to find out where to focus your improvements Wrangle Perl code to make it more presentable and readable See how Perl keeps track of package variables and how you can use that for some powerful tricks Define subroutines on the fly and turn the tables on normal procedural programming. Modify and jury rig modules to fix code without editing the original source Let your users configure your programs without touching the code Learn how you can detect errors Perl doesn't report, and how to tell users about them Let your Perl program talk back to you by using Log4perl Store data for later use in another program, a later run of the same program, or to send them over a network Write programs as modules to get the benefit of Perl's distribution and testing tools Appendices include "brian's Guide to Solving Any Perl Problem" to improve your troubleshooting skills, as well as suggested reading to continue your Perl education. Mastering Perl 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. Mastering Perl -1 Table of Contents 3 Foreword 8 Preface 9 Structure of This Book 9 Conventions Used in This Book 11 Using Code Examples 11 Safari® Enabled 11 Comments and Questions 12 Acknowledgments 12 Chapter 1. Introduction: Becoming a Master 14 What It Means to Be a Master 15 Who Should Read This Book 16 How to Read This Book 16 What Should You Know Already? 17 What I Cover 17 What I Don’t Cover 18 Chapter 2. Advanced Regular Expressions 19 References to Regular Expressions 19 (?imsx-imsx:PATTERN) 22 References As Arguments 24 Noncapturing Grouping, (?:PATTERN) 25 Readable Regexes, /x and (?#...) 26 Global Matching 27 Global Match Anchors 29 Lookarounds 31 Lookahead Assertions, (?=PATTERN) and (?!PATTERN) 31 Positive lookahead assertions 32 Negative lookahead assertions 33 Lookbehind Assertions, (? shift operators 263 Bit Vectors 264 The vec Function 265 Bit String Storage 267 Storing DNA 270 Keeping Track of Things 270 Summary 272 Further Reading 272 Chapter 17. The Magic of Tied Variables 273 They Look Like Normal Variables 273 At the User Level 274 Behind the Curtain 275 Scalars 276 Tie::Cycle 276 Bounded Integers 278 Self-Destructing Values 280 Arrays 281 Reinventing Arrays 281 Something a Bit More Realistic 285 Hashes 290 Filehandles 292 Summary 294 Further Reading 295 Chapter 18. Modules As Programs 296 The main Thing 296 Backing Up 297 Who’s Calling? 297 Testing the Program 298 Creating the Program Distribution 299 Adding to the Script 301 Distributing the Programs 305 Summary 306 Further Reading 306 Appendix A. Further Reading 307 Perl Books 307 Non-Perl Books 308 Appendix B. brian’s Guide to Solving Any Perl Problem 310 My Philosophy of Problem-Solving 310 My Method 311 Index 315 "This is the third in O'Reilly's series of landmark Perl tutorials, which includes Learning Perl, the introduction to the basics of Perl syntax, and Intermediate Perl, the guide to creating re-usable Perl software. By conveying Perl's special models and programming idioms, Mastering Perl pulls it all together to help you bend Perl to your will." "This book isn't a collection of clever tricks, but a way of thinking about Perl programming so you can solve real-life problems of debugging, maintenance, and configuration that you encounter as a working programmer." "Mastering Perl starts you on your path to becoming the person with the answers or, failing that, the person who knows how to discover and troubleshoot the problem."--Jacket