My go-to use case for modern Perl is to be the default program instead of sed. Sed regex support is abysmal and the same command line flags behave differently between BSD (and macOS) and GNU versions, in particular the `-i` for doing replacements - the number one use case for the program. So, this means that many shell one-liners and small scripts don't really work the same way on macOS and on Linux, and it's pretty annoying.
Perl is straight up better. You need to remember one word: pie - for it's command line options, and now you can do:
```
echo "John Doe" > name.txt
perl -p -i -e 's/(?<first>\w+)\s+(?<last>\w+)/"$+{last}, $+{first}"/e' name.txt
# name.txt after the command: `Doe, John`
```
First of all, it woks the same way across platforms.
Second, you get all sorts of goodies: named capture groups, lookahead and lookbehind matching, unicode, you can write multiline regexes using extended syntax if you do something complicated.
And finally, if your shell script needs some logic: functions, ifs, or loops, Perl is straight up better than Bash. Some of you will say "I'll do it in Python", and I agree. But if your script is mostly calling other tools like git, find, make, etc, then Perl like Bash can just call them in backticks instead of wrapping things into arrays and strings. It just reads better.
BTW Ruby can do it, too, so it's another good option.
I remember π and e and type
perl -pi -e '...' file.txt
And if you are using a newer Perl they sometimes add features that aren't enabled by default unless you opt-in with a 'use v5.38' style declaration.
If you want those features on in your one-liner you can use -E instead of -e
perl -pi -E '...' file.txt
(I used to need this long ago when I wanted to use the then-new "say" in my one-liners)
At my work we use perl extensively for utility scripts and such. In the past few years there has been a push to write new scripts in python, but I don't really see the point. It has most of the same drawbacks that perl has: 30x slower than a compiled language and dynamic typing.
We have many scripts that range from 5.8 to 5.36 and everything in between. 5.8 is 20 years old. Someone did a search & replace on the shebang lines to move all the older ones to 5.20 (why they picked that one, I don't know) and everything just continued to work.
I prefer perl over python. turn on use strict, use warnings FATAL => 'all' and use modern function signatures. Perl is still great for its purpose.
It's stable, installed everywhere, and I use programs written in Perl like when building Linux From Scratch. I haven't written in Perl since the 1990s. I do read code written in Perl and Raku, and I am often impressed by how succinct the code can be.
> for a scripting language there's nothing else that ticks the same boxes
I think Python ticks almost all the same boxes (and is much better designed in my opinion).
By far not. It's only more readable, but much more verbose, overarchitectured, slower and esp. unstable. Old perl scripts still work fine, old python scripts are not only many, many files, but also break every other year.
And you cannot just install a python module as you install a perl module. You need venv everything because it's soo fragile.
But this 10k sponsoring is not really worth mentioning. It's just like Platinum sponsorship for one of their conferences.
>It's extremely stable, ... It's a shame it's so dead,
The former is the consequence of the later. Popularity kills stability. Perl is the ultimate sysadmin language because it's so portable and never changes. We really lucked out with the Raku thing driving people away to python. Because of it my perl scripts I wrote in 2003 run on perl system interpreter today and the vast majority of my perl written today would run on a 2006 perl interpreter (some functions missing in some libs in troublemakers like Gtk bindings, etc), but it's generally very good.
These days with python you can't even run any random script written today on your system python from today. You have to set up an entire separate python for every script. And don't even think about trying to run a python script from 2006. That's what popularity does: fracture.
Good old Java is also stable and yet popular. It is not particular "trendy", thought. My feeling is that languages which "live in"/"create" ecosystems such as JVM, BEAM or even LLVM have a better probability to outlive other languages in the long run. Let's see what happens with golang in some years... ;-)
Stable? Huh. Never thought of Java that way. Dead, yes, but it was never stable. In my experience I have to set up a custom JVM version for every java application I've come across. Is your experience different?
Dead? Really? It's one of the most popular computer languages. And it constantly evolves and becomes better over time.
For me, Java died with Oracle shenanigans. I moved to C#. Java isn't truly dead yet but I think it will slowly die off because of Oracle. Same as Solaris and SPARC, but a little slower.