Back in September 2010 I wrote a piece criticising the way that Perl had been described in a recent issue of Linux Format. In a response to my article, the editor wrote:

And, believe it or not, I do care about Perl. I met Paul Fenwick a few months ago, and he agreed to write a Perl tutorial series for us – I hope you agree with my choice!

So when I saw that a new series of Perl tutorials was starting in the “Coding Academy” supplement of the new issue (#149, June 2011) I was looking forward to reading a useful introduction to the language written by Paul Fenwick.

Unfortunately, I was disappointed. The tutorial was written by Marco Fioretti and, to be honest, it really wasn’t very good. It failed on three fronts.

The English wasn’t very good

The explanations of Perl were, in places, rather out of date or just plain wrong

The sample Perl code included some rather outdated practices

Let’s look at those three areas in more detail.

English Language

Obviously, English isn’t Marco’s first language. And his English is far better than my Italian. But I’d like to think that if I was writing for an Italian magazine, then the editors would tidy up my writing so that I didn’t make myself look too foolish. It appears to me that the Linux Format editors did nothing to correct Marco’s English. Here are a few examples of infelicities that slipped through.

“Before looking at the code, however, let me explain which data it uses…”

“Perl arrays and hashes are much more flexible than it shows in these pages…”

“The complete code of the procedures is in the DVD”

Of course, there’s nothing terrible there. We know what Marco meant. But the magazine would have looked a lot more professional if the editors had taken the time to edit this article.

Misunderstanding Perl

Marco’s knowledge of Perl seems a little mixed up or out of date in places. For example, he says:

You call a subroutine by adding a & to its name and passing parameters

It’s been several versions of Perl since the & has been required on a call to a subroutine. You won’t see it in any modern Perl code. It just makes the code look unnecessarily messy. Later on in the article, Marco says:

Perl does have while, if, for and unless, but it lacks a C-like switch operator for multiple, mutually exclusive choices.

The Switch module was added to Perl in version 5.8.0 (in July 2002). A much improved version called given/when was introduced in version 5.10.0 (in December 2007). Anyone who thinks that Perl doesn’t have a switch statement simply hasn’t been keeping up.

Outdated Perl

The Perl idioms that Marco uses are often somewhat outdated. In particular he uses the two-argument version of open instead of the safer three-argument version. He also uses global filehandles instead of lexical ones.

Marco also has a rather distinctive style for his Perl code, much of which runs counter to the advice in the perlstyle manual page or the Perl Best Practices book. In particular, his use of capital letters for variable and subroutine names will look very strange to someone used to reading Perl code formatted in a more traditional manner.

All in all, I think that Marco’s style does nothing to counter the reputation that Perl has for encouraging unreadable code and that with a little thought the same program could have been written in a far more readable manner.

Marco’s attitude to keeping up to date with Perl is nicely demonstrated by the books he recommends. “Programming Perl” and “The Perl Cookbook” were last updated in 2000 and 1998 2003. He would have been far better off recommending “Learning Perl” (which does keep up to date – the fifth edition was in 2008 and the sixth is currently in progress) or Modern Perl.

It’s a shame that the promised series of articles by Paul Fenwick hasn’t materialised. But it’s even more of a shame that Linux Format has fallen back to using articles written by someone who is not interested in keeping up to date with modern Perl. In light of this disappointment, I’d like to make the following offer to Linux Format.

If you want someone to write an article about Perl (whether that’s a one-off article about a particular topic or a series of tutorials), if you get in touch with me then I will find the best person to write that article for you. I may even do it myself if I have the time and the knowledge. Further to that, I am more than happy to proof-read and edit any Perl articles that you have currently in the pipeline.

I don’t believe that the Perl community in the UK is particularly difficult to track down. but if I’m wrong then I’m quite prepared to the the conduit that people to use to contact the community.

[I’ve found the sample program from the tutorial on the CD and have put it online.]