Perl in 2020: Is It Still Worth Learning Now?

I got a little nostalgic going through my bookshelf and finding all of my Perl books. I’ve been in a constant state of decluttering to keep my habit of hoarding useless junk from getting out of hand and I stumbled on the little bits of my Perl bookshelf I had left. All I had left was the Perl Cookbook and Mastering Algorithms with Perl. Did Perl still stand up as a viable solution in 2020 or was it just my nostalgia from working with it years ago?

Perl is often associated with being the predecessor to PHP and known for the CGI messes popular in the 90’s before the Dot Com Crash. I didn’t start learning Perl until well after it developed its reputation as a “write only language”. Perl wasn’t my first programming language, but it was my first language to really learn.

The State of Perl in 2020

In October of 2019, Perl 6 got renamed to Raku. When I first learned about Perl in the early 2000’s, everyone told me to skip Perl 5 and just wait for Perl 6. I waited for a few years but eventually I had someone who could show me a real use case for Perl. Perl 5 is now just called Perl, and Perl 6 is its own language to avoid the pain and confusion from the mixed association (or decades long wait).

Perl excels at working with text. It is an amazing language for processing logs, data munging, and pretty much anything you want to do from a command line. Even with its history as being behind the monstrosity of Perl CGI, there are new frameworks like Dancer for modern webapps.

Perl is still very much a viable choice for modern programming. CPAN (a massive repository of Perl libraries and modules) is alive and well, and the majority of useful modules continue to be maintained. Books like Modern Perl give the style to keep Perl modern without falling victim to the mistakes of the past.

Keeping Perl Relevant

Perl evolved from a “Swiss Army Chainsaw” language into a mature, general purpose scripting language. It’s grown to have certain problems it’s better at and others where it’s best to not even bother unless you just love the language. I’m not going to pick it for a GUI, but I won’t skip it without another reason when working with data or a command line.

The language continues to be updated and 5.8 is the baseline standard for the language. MacOS deploys with Perl, it works on the Linux subsystem for Windows or via Strawberry Perl for scripting (but it probably isn’t anyone’s first choice), and it’s present on virtually every Linux distribution (and even required in many) and every MacOS install. It’s available and standard enough on every modern POSIX platform, and can even play nice on Windows.

I used it as the base for a scripting language to address the shortages of an RMM tool on MacOS. There was no install like with most languages on an older Mac, and it took less than a day to implement. Virtually every Mac which gets onboarded deals with that scripting engine, and it hasn’t been maintained in any serious capacity past initial implementation.

What Happened to Perl?

Perl tried to be too much for too many people. Snippets of terrible code floated around and were pulled in without a second thought on many projects. Script kiddie after script kiddie cobbled together their abominations and let them loose on the world. They threw the source online for the world to see for free too. Books were also rife with trash and republished even when they had long since become obsolete.

The first skill I acquired past the initial language parts was how to sort good Perl code out from the garbage. If it didn’t run with strict and I couldn’t figure out why, it was probably bad. Don’t get me wrong, there were plenty of examples which worked with strict on but were horrible too, this was just the easiest first step to sorting them out.

The whole Perl 6 situation killed Perl’s chance of getting back in the limelight for years. Perl 6 was “right around the corner” for over a decade of me using Perl. Even when I first learned Perl, Perl 6 was “a work in progress which will be out soon”. This constant setback, combined with the issue of the semantics around the name of the language hurt adoption of Perl 5 which was still alive and well. The pollution of Perl resources combined with the promise of Perl 6 robbed Perl 5 of it’s early adulthood as a programming language.

What Made It Better

Now that Perl has been out of the limelight for a while, a lot of the garbage code is fading into the abyss of the internet. The language has become more refined as it becomes more mature as long as you don’t try to take it too far out of its element. I can spend a weekend on boiler plate code with most languages, or finish the project over the course of a Friday night with Perl.

Frameworks like Dancer fill in the same space as frameworks like Ruby on Rails and help bring the language back to relevance for those serious about it. It’s not the hip new thing to learn, but if you have to use Perl anyway, it’s easy to stay modern despite the rumors. As it stopped trying to do everything for everyone, Perl found its groove.

When Is It Worth Learning?

Perl is still relevant to many types of problems, but it does have its weaknesses. You probably shouldn’t design a GUI in Perl (unless you’re just dying to use Perl). At the same time, a program that takes me days in Lua will take me hours in Perl. Each language has its specialty.

For the difference between Perl 5 and Raku, it just depends on what you want to do with it. Are you going to maintain anything legacy? Did you pick Perl because it was the lowest common denominator or do you just like the language? Raku may be the evolution of Perl, but it’s not on every Mac, Linux, or BSD box. Perl is though.

If you want a Swiss Army Chainsaw that can do a lot with a little, and don’t mind sorting through questionable examples, Perl is for you. If you don’t need the most cutting edge and don’t mind older paradigm, Perl will be reliable and faithful. It’s a language unlike most others and one I wish I could find a use for in my current job again. Even without the rose tinted glasses, Perl is still the same old flame it always was.

When you leverage its strengths, it’s a beast. Write modern code with modern tools. Throw out CGI and use Dancer, skip reinventing the wheel for no reason and use a sane module. Not every script needs to be a new tournament of golf.

1 thought on “Perl in 2020: Is It Still Worth Learning Now?”

Comments are closed.