BUY THIS BOOK

Safari Books Online

What is this?

Looking to Reprint this content?

Perl Cookbook Tips and Tricks for Perl Programmers

By Tom Christiansen, Nathan Torkington
First Edition  August 1998 
Pages: 794
ISBN 10: 1-56592-243-3 | ISBN 13: 9781565922433
starstarstarstarstar (Average of 11 Customer Reviews)

This book has been updated—the edition you're requesting is OUT OF PRINT. Please visit the catalog page of the latest edition.

The latest edition is also available on Safari Books Online.

Book description

The Perl Cookbook is a comprehensive collection of problems, solutions, and practical examples for anyone programming in Perl. You'll find hundreds of rigorously reviewed Perl "recipes" for manipulating strings, numbers, dates, arrays, and hashes; pattern matching and text substitutions; references, data structures, objects, and classes; signals and exceptions; and much more.
Full Description

The Perl Cookbook is a comprehensive collection of problems, solutions, and practical examples for anyone programming in Perl. Topics range from beginner questions to techniques that even the most experienced of Perl programmers will learn from. More than just a collection of tips and tricks, the Perl Cookbook is the long-awaited companion volume to Programming Perl, filled with previously unpublished Perl arcana. The Perl Cookbook contains thousands upon thousands of examples ranging from brief one-liners to complete applications. Covered topic areas spread across nearly four hundred separate "recipes," including:
  • Manipulation of strings, numbers, dates, arrays, and hashes
  • Reading, writing, and updating text and binary files
  • Pattern matching and text substitutions
  • Subroutines, libraries, and modules
  • References, data structures, objects, and classes
  • Signals and exceptions
  • Accessing text, hashes, and SQL databases
  • Screen addressing, menus, and graphical applications
  • Managing other processes
  • Writing secure scripts
  • Client-server programming
  • Internet applications programming with mail, news, ftp, and telnet
These recipes were rigorously reviewed by scores of the best minds inside and outside Perl, foremost of which was Larry Wall, the creator of Perl himself. The Perl Cookbook is written by Tom Christiansen, Perl evangelist and coauthor of the bestselling Programming Perl and Learning Perl; and Nathan Torkington, Perl trainer and co-maintainer of the Perl Frequently Asked Questions list.

Browse within this book

Cover | Table of Contents | Colophon




Featured customer reviews

Write a Review


Perl Cookbook Review,  June 10 2003
Rating: StarStarStarStarStar
Submitted by Wortwart   [Respond | View]

You work with Perl? You need this book - almost daily. It gives you well written explanations of code snippets for your everyday work. Indispensable!


Perl Cookbook Review,  February 26 2003
Rating: StarStarStarStarStar
Submitted by Al Rizo-Patron   [Respond | View]

A clarification to my previous comment: I said tctee.pl does not work for binary files. That is true only for Windows, not Unix. To make it work for Windows, it needs to use the binmode() function on the filehandles. Unix ignores binmode(), and then again, it already has 'tee'. Still, tctee example given can be *very* slow in Windows on binary files because any character picked as a record delimiter could occur literally millions of times. Therefore, the I/O is better done with sysread() and syswrite() with a reasonably sized block size, or something like $blksize = (stat $fh)[11] || 131072;


Perl Cookbook Review,  February 24 2003
Rating: StarStarStarStarStar
Submitted by Al Rizo-Patron   [Respond | View]

Excellent, practical complement to the Camel book.

One comment though: In example 8.19 Program: tctee (pages 304-306) the author states this "tee" replacement is one of the many venerable Perl programs written nearly a decade ago that still runs perfectly well... But if it ain't broke..."

Unfortunately, tctee.pl is not a replacement for tee. While tctee.pl handles text files OK, it does not work for binary files, whereas "tee" does.

It's left as homework for the reader to work a more general solution that does subsume tee.

In spite of this "nit," this is definitely a book to have handy when you want to solve some practical problem in short order.

Read all reviews


Perl Cookbook Review,  February 08 2002
Rating: StarStarStarStarStar
Submitted by Julio   [Respond | View]

Are you hungry for Perl then the CookBook provides the right menu of recipies.

Small samples of perl programs all over the book to solve particular problems.

I can always learn from any program example (you can get good Ideas to solve your own problems or maybe if you get lucky your problem solution is on the book) the good ones and the bad ones there is also a lot of information. If you are a novice or advance user you will be able to benefit from this book alike.

If you can only afford two perl books go for Programming Perl (Cammel Book ) and this one!.




Perl Cookbook Review,  April 01 2001
Rating: StarStarStarStarStar
Submitted by Pete Nelson   [Respond | View]



The Perl Cookbook is the most definative, useful programming book I have ever seen. Very well organized, a quick glance through the table of contents will usually point you to the answer to just about any How do I ... ? question.

I think the quality and organization of this book is a stunning example of how a good programming reference should be written. I only wish there was something comperable for Java!

If you use perl at all, this book belongs open on your desk! It will save you hours of digging!


Perl Cookbook Review,  March 19 2001
Rating: StarStarStarStarStar
Submitted by John Powell   [Respond | View]

This is the book that takes you over the (Camel's) hump from "Perl student" to "Perl user". I had read the Camel book, thought I had some clue, but locked up when it came to actually doing something useful. The well documented recipes in this book got me past roadblocks and into the realm of productivity. Without it, I would probably still be wallowing in Excel and a text editor to parse log files.

I HIGHLY recommend this book to other Perl newbies trying to bridge the gap between knowing the basics and actually doing something with it. This book ROCKS!




Perl Cookbook Review,  March 02 2001
Rating: StarStarStarStarStar
Submitted by Ismo Kallioniemi   [Respond | View]

Quite excellent book. Having read the 'Lama' and 'Camel' this is actually the book that gets it all together. If you learn from examples of code, this is definetally the book you should have.


Perl Cookbook Review,  February 16 2001
Rating: StarStarStarStarStar
Submitted by Michael Turley   [Respond | View]

Re: Previous comment

Sorry, just remembered that you can 'use lib "/path/to/myperlmods/"' to include Perl modules not installed on your perl installation. Should have read chapter 12 before posting last comment!


Perl Cookbook Review,  February 16 2001
Rating: StarStarStarStarStar
Submitted by Michael Turley   [Respond | View]

Excellent practical book - the only problem I had is that alot of the examples seem to be based on modules which you may not have the rights to install or may make an application less portable. The book is still first-rate though.


Perl Cookbook Review,  September 01 2000
Rating: StarStarStarStarStar
Submitted by Justin Flavin   [Respond | View]

As a newbie Perl programmer, I found this book completely awesome - it revealed to me , for the first time, the enormous power contained within Perl. Ok, I dont understand much of the code yet, but if you are thinking of getting into Perl or if you simply dont know what Perl is really about, get this book and you'll be really inspired.

On the strength of this (my first) Perl
book, I bought "Perl in 24 hours", and i'm getting the Camel book as well, as I thought to myself "Now I MUST really get to grips with Perl!!"

You won't use this book initially whilst learning
perl, but you'll definitely turn to it once you feel competent enough that you want to try something more than what is contained in your usual introduction-to-perl style books.




Perl Cookbook Review,  June 24 2000
Rating: StarStarStarStarStar
Submitted by Dave Mittner   [Respond | View]

This book is awesome, and I'm not one for reading much. My boss asked me to learn Perl about 8 months ago and the person I went to for help owned this book. I later asked my boss to purchase it for the department, which he did, and I just now bought it for myself. I now know a good deal about Perl and CGI, but I still find myself refering to it's very helpful and straightforward information. A must buy which marked the beginning of my O'Reilly library.


Perl Cookbook Review,  December 05 1999
Submitted by Flounder   [Respond | View]



I love this book along with Programming Perl 2nd
This book goes really good with Programming Perl 2nd. Both books are a must for any Perl programmer.

I give it 10 out of 10 stars


Perl Cookbook Review,  November 26 1999
Submitted by Roman Blöth   [Respond | View]



Well, this book is the logical final step in the perl-trilogy "Learning Perl", "Programming Perl" and "Perl Cookbook".
If you liked the first two, you definitly will enjoy this one - it gives your knowledge the final finish you need to accomplish all perl tasks. Excellent.




Perl Cookbook Review,  April 18 1999
Submitted by Phil   [Respond | View]



I found the Perl Cookbook to be a nice "classroom
in a book." I purchased it while taking a course
in Perl and found that it was like having lecture
notes in book form.

I very much like the digestable chunks in which it
is presented. It reminds me of the *excellent*
Unix Power Tools tome. If nothing else, you need
a copy in the bathroom.

The only complaint I had regards the quality of
the book binding. Within 3 days of *very* light
usage, the binding had seperated from the back of
the book; not nearly as nice as the lay-flat
nutshell bindings.


Perl Cookbook Review,  April 10 1999
Submitted by Matt Harrison   [Respond | View]



indispensable... even more necessary than the camel imho...
i couldn't fathom how much time and page-flicking i've saved since owning it - the 'recipe' format is remarkably intuitive and oh-so appropriate for a reference book. An excellent book to learn perl with too, if you already know how to program.
yet another o'reilly must-buy (does o'reilly publish any books which aren't good or excellent?)

matt harrison,
Biochem PhD student, and late-night nouveau-hacker



Perl Cookbook Review,  February 17 1999
Submitted by Colin Jitlal   [Respond | View]



The "sheep book" doesn't have quite the same ring as
other OReilly Perl books, but its contents are up to
the same OReilly standards.

In just three days of owning this book, I have been
amazed at how many times I've had to refer to it already!

This is a great complement to the Camel book!


Media reviews "Worth reading."--Dave Cross, Linux Format, May 2002

"Every serious Perl programmer knows and cherishes the 'Perl Cookbook' (O'Reilly)."
--Armijn Hemel, http://e-zine.nluug.nl/

"This book is a wonderful collection of code examples and mini-tutorials covering many, many areas. Very nice."
--Emmie Lewis, About.Com Perl/PHP Guide

Read all reviews

See larger cover