Perl is still relevant
stackoverflow.blog
stackoverflow.blog
Many of the things the author cites are good about Perl are, in fact, good about Perl. But if you're writing new software in 2022, you should probably pick a language with a future, and that language is probably not Perl.
Perl may not have a future, but being the language in which you can summon Cthulhu with the fewest characters, it has an eternal, undying past.
A combination of Bash (sed, awk, grep) and Python (string manipulation) eliminates any need for Perl.
$id = $q->param('id');
$stmt = "select envip,mailfile,headers,subject,size,fromid,toid,date from quamail where id = $id";
Yikes. His claimed expertise is "Protect your e-mail server from ransomware attacks" too.https://www.geeksforgeeks.org/perl-taint-method/#:~:text=Tai....
But beyond that? I think not.
As an application programmer Perl will never be a daily tool for me. So it gets relegated to that once in a while toolshed. But then that Tim Toady slogan kind of might get in the way: I don’t want to google for all kinds of “creative” ways to just get from A to B. Because I will surely be in that annoyed, I just wanna get this thing done kind of mood (is “in anger” the right phrase?).
> We can easily invoke a Perl daemon to avoid spending hours working on C and avoid several security flaws.
> […]
> In today’s event-loop-centric asynchronous world of JavaScript, node.js, and TypeScript, Perl offers a very straight-forward code flow, and Perl code offers simplicity and control.
In a few paragraphs the author went from some ’90s looking argument (you don’t even have to touch C) to mentioning baby’s first exotic synchronous programming encounter. I almost got a whiplash.
Probably not quite. You don't have to be angry to use a tool "in anger"
Something used in anger would be "used for its intended purpose, or used for real rather than in tests"[0]. In this context, perhaps running Perl on live production servers.
[0] https://english.stackexchange.com/questions/30939/is-used-in...
I am not a native speaker, although I have a decent level in english (enough that some native english speakers thought I was on multiple occasions, which boggles my mind).
So, somehow I always had an uncanny feeling with "in anger": much to my surprise I intuitively wanted to use it the "proper" way regularly but somehow always refrained from it because rationally I thought it really carried the literal "angry" weight, even though it just didn't feel true.
Idioms really can turn out odd.
I know why I would pick Perl over bash. But why should I pick Perl instead of Python or Ruby? Ruby is a natural choice for all the things he mentioned too. That's the question I would've liked answers to.
Nostalgia, maybe.
Scripting Language Runtimes Deprecations
Scripting language runtimes such as Python, Ruby, and Perl are included in macOS for compatibility with legacy software. Future versions of macOS won’t include scripting language runtimes by default, and might require you to install additional packages. If your software depends on scripting languages, it’s recommended that you bundle the runtime within the app.
[0] https://developer.apple.com/documentation/macos-release-note...
> It is still being used in CGI scripts. It is used in several sys admin tasks. > Perl is still alive and kicking.
I thought this was an article in favor of Perl, but when you write things like this in the conclusion you don't make your job easier... I agree though, there will be perl code around for decades, even just because some ancient systems were written in it and they haven't been replaced (yet). But at the same time, if I were a CTO at a company with 5-10 critical Perl scripts my first instict would not be to hire more Perl devs but to migrate away from that ASAP.
I don't hate on Perl, the first code I ever got paid to write was Perl. It's not a bad language. It's also not a good language. It's a nice glue language you can assume will exist on any random Unix-like machine you sit down at. Its nice in that it can replace a mess of bash/awk/sed scripts.
That being said I could not imagine starting a green field project today in Perl unless everyone on the team was a Perl monger. Even then I think there's much stronger options than Perl for most types of projects.
Edit: autocowrong typo
I acknowledge that every mind is different, and folks are drawn to different languages. I've met engineers who hated syntax coloring. But for the mind behind my own eyes, I love Ruby, hate Perl.
If you consider "never-ending development" until the first release, then Perl 6 ended development in 2015 when it was released.
If you consider "never-ending development" biologically, then it just means that the language is alive. Which it is, and Perl as well for that matter.
If you consider the language "Perl", then it should continue to be noted that for Larry Wall, Perl 6 (now Raku) still IS the next version of Perl. It just has a different name now.
Perl is also really fast to prototype with, with a lot of nice helpers for scripts like while(<>) { say $_; }, make writing oneliners/short scripts easy.
I find Perl is a good fit above bash.
I know some might consider this heretical, but have you considered Powershell for these type of scripts?
No language I am aware of have more footguns than bash, with the exception of some other Unix shells.
But really, I really like Perl for throwaway scripts and one-liners. Because of its syntax, Python essentially can't do one-liners, and generally, Perl code is shorter and quicker to write assuming you are experienced in both languages.
But I agree that readability is terrible unless you are really careful. When my Perl scripts get a bit too big, slow, and less "throwaway", I tend to rewrite them in another language. Often C or C++ because I know these well but I guess that Go can work too.
Python has some great features, it is simple and code is naturally readable, but for me it sits on an uncomfortable spot: not permissive enough for quick, throwaway code, and too permissive and slow for larger, maintained projects.
The lack of stackoverflow questions probably has something to do with code written 10, 15, even 20 years ago still working, without a need to constantly rewrite it, because language writers change the language every two versions, or distro mainatainers decide to deprecate the language.
I'm speaking as someone who had the misfortune of maintaining one of those 15 year old legacy Perl systems.
After finally rewriting the Perl based systems in Go, our outages went to nearly zero, and we could handle multiple times more traffic.
Engineer on-boarding was also easier because they could understand what was going on by just being able to read the code. A novel concept, I know.. /s But that was impossible to do with the Perl based services.
Maybe this works if you run your Perl in the exact same environment the whole time, or if you're writing stuff on a very small scale and don't need to use many CPAN modules.
But for large applications, you'll be using CPAN modules heavily. And you'll need to run your Perl in new environments - if for no other reason, because you'll need to move to new operating system versions to pick up security updates.
That's where the problems start. If you're using a reasonable number of CPAN modules, this inevitably breaks some of them. And because the Perl ecosystem is essentially dead, those third-party modules are usually abandoned.
Ask HN: Is perl still relevant today? - https://news.ycombinator.com/item?id=11406046 - April 2016 (4 comments)
There's not a timeline for that right now, nor clear consensus on what exactly will be worth a version bump or how much backcompat between 5.x and 7.x there will be going forward. It's being actively discussed, though; the Perl Steering Committee (formed a couple of years ago) meets weekly, and discussion on p5p (the language development mailing list) is still fairly active, though admittedly much less so than in years gone by.
That kind of goes against the point of Perl being modern..
No doubt Perl is much more powerful than AWK. But from other side it’s astonishing that such succinct and clear language as AWK was turned into a monstrosity called Perl.
Therefore, for me when it goes to text processing/manipulation I prefer AWK much better than Perl. Cleaner syntax, better portability, absolute minimalism. Now, thanks to GoAWK [0] CSV-processing with AWK is a piece of cake too.
I personally see no reason nowadays for me to write any Perl code, but I’m totally fine to use the software written in it.
I seem to stumble quite a bit with CPAN in comparison to pip or npm. Correct me if I'm wrong, but I think that's because it's not a true package manager like those, and more of just a module downloader that's not as stateful?
CPAN pains I think are a huge reason why I haven't learned it better, also I think Perl can vary quite a bit with readability compared with other languages.
You can write nice looking Perl like those examples but I've also seen things with extremely dense and terse syntax that I can't even begin to walk through. To take an extreme example, RSA in 3 lines of Perl. I have always been curious how that is actual working code.
To use RSA as an example, instead of trying to use a PGP module from CPAN, I use the gpg command-line program, write its output to a file, and use that.
It's not as graceful, but it is also highly compatible with just OS packages.
What makes you choose Perl over bash/sh then, if it's working as a "glue" between actual binaries? I imagine the text processing things it excels at?
I feel comfortable with parentheses, curly braces, freeform whitespace, etc., if/else, do/while, foreach, etc., and that's how I write my Perl.
I sometimes call it "PHP style Perl", because most of the code i write can be copied and pasted almost verbatim between PHP and Perl, and I use this to my advantage.
I don't use PHP a lot, but I do find it one of the most convenient ways to duct-tape things to a web server.
On the whole, I've settled on a strategy of writing most code in such a way that it could have been written (with perfect foresight of the future) 20 years and go and have worked the whole time.
I think of it as exploiting the Lindy Effect to my advantage. :)
It downloads dependencies automatically and does a reasonable job with --uninstall, which is probably your main complaints.
> Python is an out and out object-oriented paradigm.
Is this true? I thought it was considered 'multi-paradigm'. You could write a program without using a class for instance which is difficult (impossible?) in Java or C#.
More on topic, I used to do a ton of perl in the late 90's through the early 2000's. Before PHP gained popularity, it was a simple way to write a web app (perl CGI.) I haven't touched it in over a decade now.
6% of git is perl! perl is everywhere!
... wait those are actually Tcl.
I used to randomly do a thing or two in it because it seems like "there's a CPAN for that".
Once in a great, great while I'll have a script that's part of something that needs a change.
But I won't write it if I don't have to. Why would I? Python has too many advantages and also has all the libraries I could want. My co-workers know it, it's easy to read and write...
Yea, historically, every time I followed that siren song of "there's a CPAN for that", it inevitably led to ruin and tears. I found my CPAN experience to be buggy, fiddly, and overall unsuccessful. It's what drove me away from the eco-system entirely.
It's one of those things that, if days had 72 hours and the human average lifespan was 300 years, I would love to master.
Unfortunately, that isn't the case.
there's also a deno port[2].
every perl library I make use of is updated regularly
perl itself is released regularly and just had a 5.36 release
perl won't be conquering much new territory, but it isn't going away either