Part of the fun of programming in Perl lies in tackling tedious tasks with short, efficient, and reusable code. Often, the perfect tool is the one-liner, a small but powerful program that fits in one line of code and does one thing really well.
In Perl One-Liners, author and impatient hacker Peteris Krumins takes you through more than 100 compelling one-liners that do all sorts of handy things, such as manipulate line spacing, tally column values in a table, and get a list of users on a system. This cookbook of useful, customizable, and fun scripts will even help hone your Perl coding skills, as Krumins dissects the code to give you a deeper understanding of the language.
You'll find one-liners that:
And many more! Save time and sharpen your coding skills as you learn to conquer those pesky tasks in a few precisely placed keystrokes with Perl One-Liners.
About the Author
Peteris Krumins is a programmer, systems administrator, start-up manager, and all-around hacker. He is the cofounder of Browserling and Testling, and he runs the popular programming blog catonmat.
Table of Contents
Chapter 1: Introduction to Perl One-Liners (PDF)
Appendix A: Perl’s Special Variables
"A great reference for when you want to do something with Perl without spending an hour or two trying to figure out how."
"By reading this book and trying the recipes, you’ll master shortly all the command-line options that can turn the Perl interpreter into a sed-awk-grep-toolboox-on-steroids."
"Having the book to hand will allow you to call on Perl's full power in an instant when the need arises."
"This is a tinkerer's dream. What's more, its a book that you can grab at any old time and play with for the fun of it, and yes, this book is fun."
“One of the slogans used by Perl is ‘Easy things should be easy and hard things should be possible.’ This book illustrates just how easy things can be—and how much can be done with so little code.”
“By reading this book you can make a step toward becoming the local computer wizard, even without learning how to program.”
“A set of exercises for deepening your understanding of Perl.”
“The author is enthusiastic about the material and uses an easy writing style. Highly recommended.”
“These one-liners are great. Simple. Clear. Concise.”
“A quick read full of useful command-line Perl programs.”
“Handy for anyone who does a lot of one-off text processing: system administrators, coders, or anyone with large amounts of data they need shifted, filtered, or interpreted.”