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.