Writing Maintainable Perl



By David Bradford Photo
Date: Saturday, 3 May 2014 11:30
Duration: 25 minutes
Target audience: Any
Language: English
Tags: maintainability perl style

You can find more information on the speaker's site:


One criticism of opponents of Perl is that it is a "write-only" language meaning that once the code is written, it is extremely difficult to maintain because it is difficult to understand upon re-examination. As with many criticisms, this should be aimed at those undisciplined developers who are writing the code, and not their tool of choice.

Having said that, I think it is also fair to say that Perl makes it very easy to write difficult-to-decipher code. This is the double­edged sword which is the shorthand Perl gives us to be very expressive in a small amount of space. A negative application of this is obfuscated Perl (where the author intentionally makes his code difficult to read), while a more positive application is the craft of creating Perl "one­liners" (trying to include a great deal of functionality in a single line of code). A one­liner can be a powerful weapon in the arsenal of a system administrator.

In this talk:
* We'll look at a line of code in a subroutine that is in desperate need of readability changes
* We'll make the code more readable by introducing:
    * appropriate whitespace
    * different ways of writing the same thing, for example: $array[$#array] vs. $array[-1]
    * useful names for variables, versus $index, $j $k $l, etc
    * breaking up one line of code into multiple lines
    * exploring further improvements through Perl::Critic and by extension Perl::Tidy

This talk will be beginner-friendly.

Attended by: