To my shock I saw a node today linking to's Best Perl Practices. A book I've never heard of. To my surpise, it has the best ratings of any IT book I've ever read!

How many of you have it? Has it made you a better coder? Does the ideas presented in the book help in any way with other languages you know (ASP, CFM, JavaScript, etc)?

Replies are listed 'Best First'.
Re: Best Perl Practices reviews?
by xdg (Monsignor) on Dec 15, 2006 at 12:43 UTC
Re: Best Perl Practices reviews?
by derby (Abbot) on Dec 15, 2006 at 13:35 UTC

    Note to AM ... come out from under the rock. Although PBP is a good book, sometimes I feel TheDamian jumps through some pretty funky loops to get his point across. For your first foray into best practices (or idiomatic perl), I would suggest Effective Perl Programming - which by the way has a slightly better rating (and from more reviewers) than PBP.


      An excellent recommendation, just keep in mind that EPP is getting a little long in the tooth. It came out in pre-5.005 days so some recommendations are no longer really optimal. An example that comes readily to mind since I just happened to be thumbing through my copy the other day: it recommends avoiding the overhead of /o on dynamically generated regexen by creating an anonymous coderef using string eval and calling that instead.

      ## not the exact code, but a close facsimile from memory: sub make_matcher { eval qq{sub { \$_[0] =~ /$_[0]/o } } } my $matcher = make_matcher( "dynamic" ); if( $matcher->( "dynamicorama" ) ) { # ... }

      Nowadays you can use qr// and get the same performance with less scaffolding (presuming Perl newer than 5.6.1 if I'm recalling correctly from the recent threads here on the topic).

      So keep in mind the vintage of the advice. 85%+ of it is probably still germane as is, and the remainder is sound underneath but needs slight tweaks. Of course now I probably should actually get around to swiping a coworker's PBP and reading it this weekend. :)

        qr// is first available in 5.6.0.

        ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Re: Best Perl Practices reviews?
by cog (Parson) on Dec 15, 2006 at 15:56 UTC
    How many of you have it?

    Well, I have it, and there's a couple of it at the company I work at too.

    Has it made you a better coder?

    I wouldn't necessarily say that in my case, but it's certainly made some of my guys better programmers, and their code is now easier to maintain!

    Does the ideas presented in the book help in any way with other languages you know (ASP, CFM, JavaScript, etc)?

    Yes. I'd say more than half of the ideas in the book are suitable for other languages.

    You should definitely get that book :-)

Re: Best Perl Practices reviews?
by jdtoronto (Prior) on Dec 15, 2006 at 16:37 UTC
    Yes, I have it, and I also have the older "Effective Perl Programming". I actually found PBP easier to read but bioth are useful. It has been pointed out that EPP is somehwat dated now, but still valuable.

    thedamian, as an academic, has a very different style and one with which I am more comfortable. As others have said, he perhaps contrives things a little to get his point across, but that is what he does all day!

    As for making me a better coder? Yes, it has made me rethink a number of practices, and whilst not following all his prescriptions, I can understand why he propsed them.


Re: Best Perl Practices reviews?
by revdiablo (Prior) on Dec 15, 2006 at 17:56 UTC

    As many of the other reviews undoubtedly explain -- but I'll repeat here for the sake of convenience -- the best thing about PBP is not necessarily the recommendations themselves (though many of them are excellent!), but rather the frame of mind it encourages. It asks you to consider your practices, make informed decisions, and stick with them. It also gives you a framework of practices to decide on. Even if you disagree with Damian's choice, at least you've made a choice (where before you might not have even thought about it). Highly recommended.

Re: Best Perl Practices reviews?
by andyford (Curate) on Dec 15, 2006 at 16:33 UTC
Re: Best Perl Practices reviews?
by eyepopslikeamosquito (Bishop) on Dec 15, 2006 at 22:19 UTC

    How many of you have it?
    We have a copy at work, covered in brown paper, with "Company Perl Coding Standards" scribbled on the front. Saved me the bother of writing a Perl coding standards document. :-)

Re: Best Perl Practices reviews?
by sgt (Deacon) on Dec 15, 2006 at 22:14 UTC

    PBP is a very good book. It gets actually better at each read. One thing touched only on the surface is logging (at least in the sense that it does not advise much about existing logging modules)

  • is log4X actually good for production?
  • should one prefers syslog type logging
  • etc...

    one thing I liked pretty much (and that can be said for perlhacks too) is that in the first reading (along the diagonal) you can ignore the bits you find a bit boring and browse the index for your favourite sections (some smelled real good just by the title ;)

    Inside-out OO is maybe rushed a bit. I mean the arguments are sound and I knew the technique (eh eh from here++ actually) but I felt a bit "pushed" to embrace it...after all there is a huge codebase where almost everybody has invented its own object system, so a bit more of a pacific coexistence (or survival) howto would have been good.

    still I buy a lot of books (and 80% are o'reilly books, enough to be given a prize some day :)) and PBP has been (is) my best read in months -- I must confess that on my bedtable (yeah it did not leave it yet!) it is sitting next to Pierce's Types theory and Queinnec's Lisp in little bits (and looks all the sexier...).

    hth --stephan
Re: Best Perl Practices reviews?
by rodion (Chaplain) on Dec 18, 2006 at 00:36 UTC
    In a language like Perl, one that insists on being richly pluralistic, you need some guide that points you towards what practices are conventional, clear and maintainable. PBP provides that, and is well written and insightful as well.

    We have one copy at work, and we would have more if we didn't have it available on-line on Safari. I also bought my own personal copy for home.

    The book has allowed me to write code with confidence that it will be generally understood, and it will be easier for people to find things in it in an emergency. It has also guided me towards which modules are mainstream, or may become so. It has changed how I write C, and other languages, but it has also reduced my tolerance for writing in other languages.