Why I Moved From Perl to Python, or Why I Learned to Stop With the Camel and Love the Snake
Tags: perl, python, django, php
Published: 2024-01-18 02:59:57

Hi everybody,

For those of you who have a history with my Perl Weekly Challenge solutions and who know me as one of the #perl tag moderators, I'm here to explain today why I haven't posted anything about Perl at all recently. I have entirely left the Perl ecosystem. Don't get me wrong, I don't hate it, my work has just taken me to the Python world and now there's no turning back for me.

I have long been a supporter of Perl. I started my first true personal programming project in Perl in the mid-2010s, which I then got distracted from for quite some time with other activities. When major changes happened in my life, I started working with Perl again to refresh my skills for possible employment in software development.

I know what people say about Perl, that it's dead and gone, that it's line noise, etc. But I still supported it. It was my favorite, my OG, you could say, so I stuck with it. It's not a terrible language, in my opinion.

Why did I move off of Perl then? For my new job working on a Django project I actually gave Python a chance. I was reading the Python docs and everything just seemed incredibly powerful. Like what? Some of the following:

- The ease of list comprehensions. I know I could use map() or similar looping structures, but they're nowhere near as clear as Python list comprehensions.
- True OOP. No more figuring out whether I want Moose, Moo, Mouse, wait for Corinna (which looks impressive but a decade too late), bless(), or "Ah, whatever, I guess I'll just do procedural programming, then I don't have to add a dependency."
- A real, useful, standard library. I don't want to always have to decide whether I want to use this XML library or that XML library, this JSON library or that JSON library, etc. Sometimes I just want to have a default choice, with more powerful options available if I need them.
- Maintained libraries. With Perl, do I use the arguably better-designed library that hasn't seen a single update in 5 years and has an individual inactive author, or the worse library that hasn't seen a single update in 3 years and also has an individual inactive author? (Estimates, please don't quote me or ask for specific examples.) The community just is too far declined to maintain the existing codebase effectively.
- Syntax. Python's syntax is clear, English-like, and follows rules. Perl's is full of punctuation, often strung together in a way that is only readable to an experienced Perl programmer.
- Lack of backwards compatibility. You might say that's a feature. I say it's a liability. Code that sits without maintenance is a bad thing. There is no such thing as static code in a good environment. If your code has to be static, then company requirements need to change or you simply can stick with an old version of your language. Frequent breaking changes are annoying. Occasional breaking changes are very very healthy. Holding an entire language's development back by insisting on backwards compatibility at the expense of everything else is what has made Perl unable to keep up with other languages. It's not healthy for a language.

These are my personal feelings and reasons for leaving Perl for Python. It was fun, and I wish the Perl community the best, but in my view, there's just nothing that Perl can do better than Python. (Except maybe for module imports. Have I mentioned how annoying Python imports are? No? They're annoying!)

If I had any suggestions, the biggest one would probably be to break things. If people want their 5.8 code to run, they can run 5.8. Stop catering for them and advance the language. Also I would recommend expanding the standard library with well-tested, modern libs. These are effectively the biggest issues that need addressing with Perl.

Have you switched from Perl to Python? Why have you switched? If you've considered it and stuck with Perl, why? If you're a staunch Perl supporter, why do you like it? Let us know in the comments below. Please keep it civil though.

_P.S. Why did I tag this with PHP? I meant to say something about my role now including some PHP, which I believe many feel is worse than Perl (I do). My goal is to rewrite that project eventually, because I don't want to be stuck on another declining language._