I've been searching for alternatives for about 10 years now, at first because my novice self was heaving headaches reading other people code and even my own. I hated perl but I hated everything else even more as I came to know them. No autovivification? Some assignments copy the data and some create references and you need to memorize the conventions of which does what? 3x to 10x lower performance? My program crashes because of white space? Fuck that! Back to perl5.
I'm sorry to say nothing can replace perl5 for me even now in 2019. I wish something would come along even if it takes years. We need alternatives and competition, perl5 will get too old at some point and 6 is... I don't even want to go there.
Wow, thanks. I had been looking for this word to explain what happens in awk. Now I know what it's called!
Just the syntax sugar for them is more recent.
$hash{1,2,3} = 10;
This actually ends up doing the following $hash{join($;, 1, 2, 3)} = 10;
It builds up a single key from the list using the special variable $; as a separator to the elements. With perl 5 you gained the ability to make references which allow you to actually make multiple dimensions and to do it on arrays, not just hashes. $array[1][2][3] = 10;
That also allows for more complicated data structures and much easier ways to iterate through the structures.This is a nightmare for beginner coders trying to make sense of Pandas or R subsetting.
I had heard a few perl monks criticize it a bit, as an "end run around use strict", but I was kind of dismissive. It turns out, that's a really apt way to describe it. It basically tosses the niceties of use strict out the window, so long as its a hash. And sooo many things are hashes/hashrefs in Perl.
The first time I wasted a day tracking down a bug that turned out to be a well hidden typo in a hash key assignment, changed my mind. Well... maybe the third time.
$foo = $bar{Autovivication}
instead of $foo = $bar{Autovivification}
in your program, it will abort instead of returning an undefined value :)See Hash::Util for details.
I've just written a utility I needed in Perl. I tend to think about some things in the long term, and this utility is something I want to be able to run 10 years from now.
[it's a concistency checker (hasher) for file archives, to find out if the bits in your copy are really the ones you put there, important for multi-GB photo archives — see https://github.com/jwr/ccheck]
I do most of my programming in Clojure, which has excellent backwards compatibility and takes a long-term perspective. I still run some unmodified Clojure code from 8 years ago. And yet for really long term stuff, I would much rather write it in Perl. It has been around for a very long time, is very mature, and can be expected to last, even if it isn't the latest fashionable trend.
Take a look at the various programming languages+environments around you: there will be very few where you can expect to be able to run your code even 2-3 years from now, much less decades later.
It's pretty sad too because I distinctly remember that one of the main selling points of Perl when I started using it in the early 2000's was that CPAN was more complete and diverse than any other scripting language out there.
So is Duke Nukem Forever.