Can you learn Perl from an old Learning Perl?

A question at Yahoo! Answers asks “Is it okay to learn perl with an out-dated book?”. This showed up in my Google Alerts in a new link attractor site that wants to get referral and ad revenue. It’s a four year old question, which puts it in the desert between Perl 5.8 and Perl 5.10.

I’ve seen this question several times, and I always wonder why people want to settle for such an old book. This questioner got it from a thrift store for a penny, but most people don’t say why. Is it hard to get books where they are? Did they get it cheap in a used book store, or find it in the trash? As someone who wants to make money writing about Perl, I wonder why people either don’t have the opportunity or are reluctant to pay $20 to $40 to get the latest information and the old information usually explained better. I fully realize that prices and availability outside the United States can be a problem. If you can’t get the print book, you might be able to get the ebook version, but you need a credit card to complete the purchase from either the O’Reilly website or Google Books. As with my answers to technical questions, I’d like to know why the old-book situation exists, but people often don’t tell us why they want to settle for an ancient edition.

Before I give my answer, you should remember that I get royalties from Learning Perl, from the fourth edition on, and with increasing participation in each subsequent edition, I get a greater share. It’s in my interest that everyone gets the latest version of this book.

The reader’s interest is usually learning enough Perl to use the Perl they have available to them. Unless someone is turning on a particular computer for the first time in 10 years and want to stick with that ancient version of the operating system, I’d expect the earliest Perl they might have is something in the 5.8 series.

The questioner specifically asks about a book the covers Perl 5.004. That’s a version from 1997 to 1998, depending on the subversion you use. If the book is Learning Perl, that’s probably the second edition, released in the summer of 1997. That’s 15 years ago.

If your book is pink, it’s too old

I don’t think that you need to learn Perl from the latest book. Learning Perl, Sixth Edition covers up to Perl 5.14, but if you aren’t using Perl 5.14, you probably don’t need that edition. You might get by with Learning Perl, Fifth Edition, which covers up to Perl 5.10. If you aren’t using Perl 5.10, which is the latest unsupported version, at least for another couple of months, you might get by Learning Perl, Fourth Edition, which covers up through Perl 5.8. Even though the perl developers now release a new version of Perl every year, Perl users upgrade much more slowly, especially since each new version since Perl 5.10 has few, if none, compelling features for most people.

The further back in time you go, however, the more current practice you miss. When we update a book, we also roll in the changes to style and idiom that develop as practicing Perl programmers learn more about the consequences of the old idioms. For instance, the three-argument open was introduced in Perl 5.6, but wasn’t stressed by the community until much later. Along with that, Perl 5.6 introduced autovivified scalar filehandles. I mentioned some of these in Why we teach bareword file handles. This version of Perl was a big change in Perl practice, and as such, Perl 5.6, released in 2000, is the earliest version that I think you should even consider learning. That means that Learning Perl, Third Edition, a version in which I have no financial stake, is the minimum edition you should use.

Most of the things that you’ll learn from earlier books are still perfectly good Perl, as far as the latest compiler is concerned. The perl developers have been very keen toward supporting old Perl scripts so that the code you wrote in 1995 still works with the latest perl. Very few features (such as pseudohashes) that have ever disappeared.

There’s another point that comes up in one of the answers. The “best answer” says that it takes about a year to write a book and that by the time it hits the shelves, it’s already out of date. Neither of those things is true for Learning Perl. We do a new edition in about six months, and we plan it according to the next version of perl by following the development of the experimental version. By the time the book hits the shelf, we’re usually right on time for the latest version of Perl. For Programming Perl, Fourth Edition, we’re even a little ahead since we cover some Perl 5.16 features, and that’s not even out yet.

Leave a comment

5 Comments.

  1. Hi

    Those of us that write for the web, are constrained by the perl version shipped by the Internet Service Providers, and the two ISP’s that I use, one a major UK ISP, and the other a minnow, are still working with perl 5.8. (I currently am looking after about 120 web sites on two ISP’s)

    I deal mostly with small companies that can’t afford the cost of their own servers, so I keep up to date with Programming Perl 4th Edition, just published in the UK, and get by with Learning Perl 2nd Edition as a check to make sure that I don’t get ahead of the game with the ISP’s.

    I thought I would send this information as background as to why some people might be looking at older versions of your books – which I have found well written, and easy for a newbie, as I was back in 2000. Consider myself an old hand now !! Keep up the good work.

  2. There’s a lot to like about Learning Perl, and I think it’s one of the best learning to program books written for almost any language. I’ve been going through the various beginner books in Python, PHP, and other languages, and they’re awful. I have a whole Learning Python book that has not a single program in it — just stuff you can try on the command line. Learning Perl doesn’t just go over the syntax, but gave you excellent examples and problems to try.

    The big problem I’ve had with Learning Perl (at least older editions) is it doesn’t cover references and object oriented programming which are vital in today’s Perl culture. I’d also like to see it spend more time on POD and CPAN.

  3. David Shultz

    I manage a commercial project running perl 5.6.1 with over a million lines of unit tested code. I have planned for years to upgrade but it’s simply not been a viable option until recently. That being said I haven’t seen anything compelling in 5.8+ short of threading and better unicode. Some of the new syntax almost seems childish in it’s attempt to offer sugar for newer developers.

    All this being said, I generally suggest anyone wanting to get into any new language should get the latest copy of whatever book they are thinking about. You will get the latest and most up to date information. You might find something to convince me to move forward more quickly. And you will end up with a similar knowledge set as those learning the language around you.

    Just my 2 cents.

    • In the recent editions of Learning Perl, we clearly mark the features that require a version after v5.8. In most cases, we also show the pre-v5.10 version of the way to do the task too.

Leave a Reply

Your email address will not be published. Required fields are marked *