To get the free app, enter your email address or mobile phone number.
Perl Best Practices Paperback – July 19, 2005
|New from||Used from|
Top 20 lists in Books
View the top 20 best sellers of all time, the most reviewed books of all time and some of our editors' favorite picks. Learn more
Frequently Bought Together
Customers Who Bought This Item Also Bought
More About the Author
Top Customer Reviews
Don't modify via $_ (too easy to screw things up)
Use hashes for arguments if arguments > 3 (trackability)
Use Croak instead of die (Croak gives more info, better for debugging)
Use ' ' instead of " " when no interpolation (less ambiguity)
Don't use unless (complication and confusion).
use /xms in regexes (for readability, and avoiding mistakes)
test when closing or opening a file
A few of the reviews here are 1 star. IMO these are people to which "freedom" is more important than "group code maintainability". This should really be the third Perl book for anybody, after Learning Perl and Intermediate Perl.
For those wanting to test their code against this book, there is a Perl Module, Perl::Critic, that does the job.
I strongly recommend that anyone writing Perl professionally should read this. But I do have an issue or two with it. For example, I think it was wrong to start off with a rule about brackets. That's one thing that people are religious about and there is no real reason to go one way or another. That starts the book on a weak premise. From which it quickly recovers.
Overall, a fantastic book. Well written and researched. It's the kind of book I would expect from Damian Conway and I wasn't let down. A must-read for Perl programmers.
He brings up so many topics, some well discussed and some more esoteric and presents practical benefits that almost anyone who reads it, I expect, will come away with some new habits. I think there are very few books I've ever read that could convince people to change their programming ways - years of developing versus a couple hours of reading. You may not agree with every point he makes, but he'll make you think about why you do certain things, and that can't but help make you a better programmer.
I can not recommend this book enough to any perl developer out there. If you're new to it or been doing it for years, this book is for you.
The goal of this book is teaching Perl programmers how to write their code for both readability and maintainability. We've all been there - we wrote code months or years ago, or we're just picking up someone else's code and we need to go back in and change something. The challenge is, whether it's been a long time or it's someone else's code, it takes time to remember what we were trying to do. If we are inconsistent in our coding style, it can be difficult to switch to the style of the code we're working in.
Example: (quoting the book, p 453)
Don't be clever.
Tied variables are a clever idea, but "cleverness" is the
natural enemy of maintainable code. Unfortunately, Perl
provides endless opportunities for cleverness.
For example, imagine coming across this result selector in
| $optimal_result = [$result1=>$result2]->[$result2=>$result1];
This syntactic symmetry is very elegant, of course, and
devising it obviously provided the original developer with
a welcome diversion from the tedium of everyday coding.Read more ›
Most Recent Customer Reviews
I'm glad I read this book in advance, helps me see Perl from a different perspective even though I haven't started writing my own code yet... Read morePublished 7 months ago by efrankamo
The book has many good tips to write maintainable, readable code. Although the book is focused on Perl, many of the tips can be applied to many other languages (indenting, named... Read morePublished 16 months ago by A reader
Perl is frequently criticized for being messy, hard to read, and unmaintainable... a complaint which is not without merit. Read morePublished 20 months ago by JP
The author appears to know what he's talking about, but this is just really dry and doesn't explain well WHY these practices are 'best'. Read morePublished 22 months ago by dj circuits
If you want to really clean up your Perl coding, this is the book for you, Damian Conway really covers the language it's gotcha's and how to avoid them, loads of useful tipsPublished 23 months ago by grizzlysmit
Since first reading this book, we have slowly migrated our open source projects at work, with the great help of Perl::Critic, to find that we have silently improved the overall... Read morePublished on December 2, 2013 by Deyan Ginev
Perl has received a lot of criticism about being a "write-only" language. Some of it is even deserved. Read morePublished on September 26, 2013 by Digital Moonlight
good book, well written, and a "must-read" in my office at work for using the "best practices" in writing PerlPublished on July 5, 2013 by Bob Twain