Preface

Perl is a language with a rich and expressive vocabulary. Since its original release in 1987, it's moved from quick-and-dirty extraction and reporting to web programming, data munging, GUI building, automation gluing, and full-blown application development. It's the duct tape of the Internet and a Swiss-Army chainsaw.

Like duct tape and multitools, Perl can do just about anything you can imagine and really want to do.

If you just want to get your job done quickly, you can write the simplest, easiest Perl you know and go on to other things. If you want to build big applications, you can do that—with some experience and a little discipline. If you want to solve your problem and don't mind a little help, the CPAN is there to give you a hand.

That's all very productive, and being productive can be fulfilling...but Perl can also be fun.

Imagine a litter of kittens, tumbling across the floor in a ball of teeth and claws and fur and tiny little growls. They're playing, sure, but they're also practicing the skills they need to survive in the scary wild world. They're careful not to hurt each other, but the tactics and surprises of one clever kitten can teach the others valuable lessons.

What makes a Perl guru? It's knowledge, partly, but it's mostly the curiosity to play with the language, discover surprises, and even invent a few of your own. That's why this book was so much fun to write. Here are 101 tips, tricks, and techniques from some of the best Perl programmers in the world. Some are immediately productive. Some are sneak attacks that you might only use when you have no other choice. Most of them have two parts: the immediate problem you need to solve right now and a deeper, subtler technique that you can adapt to other situations. All of them are worth studying.

It's good to be productive. That's why you program in Perl. Add in the fun of learning—especially lessons it took these Perl gurus years to learn—and you'll be ready for anything. Amaze your friends. Astound your coworkers. Walk into the jungle of code and specifications and customer requests with the confidence that you can take down any problem that jumps out at you.

You will.

Why Perl Hacks?

The term hacking has an unfortunate reputation in the popular press, where it often refers to someone who breaks into systems or wreaks havoc with computers. Among enthusiasts, on the other hand, the term hack refers to a "quick-n-dirty" solution to a problem or a clever way to do something. The term hacker is very much a compliment, praising someone for being creative and having the technical chops to get things done. O'Reilly's Hacks series is an attempt to reclaim the word, document the ways people are hacking (in a good way), and pass the hacker ethic of creative participation on to a new generation of hackers. Seeing how others approach systems and problems is often the quickest way to learn about a new technology.

It's also fun.

Of course, no single book could possibly document all of the interesting and creative and mind-expanding things people can and do achieve with Perl...but we hope this book will put you in the right mindset to hack your own crazy ideas.

Get Perl Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.