Over the past 10-12 years, Perl has been getting some significant speed boosts, on the order of 30% overall. It is of course still a very slow language when compared to compiled languages, but I'll take it.
I still code in Perl a fair bit for work. One great improvement I have taken advantage of is subroutine arguments, rather than unpacking @_ at the head of each subroutine. It is much easier to tell what the sub expects, and if the caller passes the wrong number of args it is a compile time error.
The main draw for me is that regex is built into the syntax of the language, and not a library. If the task requires a lot of pattern matching and string manipulation and speed isn't that critical, I reach for Perl.
Perl aficionado here - I love Perl for its regex as well. Whenever I need to do serious regex work (log parsing, for example), I pull out Perl. Many of the engineers I’ve worked with also don’t realize that it makes an extremely good shell interaction tool (much more powerful and intuitive than Bash scripting, for example) and I have developed many a TUI with it. I eventually learned Python as well, but always saw Perl as superior in many ways, especially when raw performance isn’t a consideration.
perl has the distinction of being designed by a linguist and, for many coders (like me), it has a very smooth and easy feeling …
… others dislike the idea of $ sigils as “noun” markers and @ sigils to denote plurals but imo these features trick your brain into engaging these natural language concepts.
In contrast, I feel that Java is “heavy”, Python is “sciency” and so on.
The other distinctive aspect of perl is that it does not seek to constrain and block the coder. Strongly typed and opinionated languages (like Rust and Haskell) can be frustrating since they force you to code their way. That’s fine - it’s in the contract. perl is for when you just want a bag of tools to get the job done without becoming a wrestling match.
This flexibility also means that non standard code is easier to write in perl. The tool gets a bad reputation at the hands of poor coding practices. A higher level of trust and self-discipline is needed.
perl6 - now renamed to www.raku.org, continues the spirit with a cleaned up syntax and a lot more features in the core language
Obfuscation coding contests, Perl golf tournaments to create the shortest feasible code for a specified function, and Perl-language poetry collections have all grown up as a result of Perl's versatility.
Your takeaway may well be that perl is not the kind of thing that your boss would like. My takeaway is that perl (and raku) is versatile and engenders a sense of -Ofun.
> This flexibility also means that non standard code is easier to write in perl. The tool gets a bad reputation at the hands of poor coding practices. A higher level of trust and self-discipline is needed.
And this becomes a problem in teams.
I do somewhat miss perl, because perl and some libraries did some things better than later languages. You could express some ideas very concisely. Or, croak and carp only reporting functions crossing module or library boundaries in a stack trace (instead of some java teams complaining that the log aggregation refuses to collect 50kb+ sized stacktraces, not even exaggerating there).
Alternatives like python force you into a more maintainable style. Like, don't get me wrong, you can write unmaintainable code in any language, and python would be my language of choice to make a horrible non-understandable mess with the extensive meta programming capabilities.
But with perl, you kinda have to put in effort to stay on the simple path. If you leave that part, it quickly becomes very dark. And I know some of my co-workers.
For me, it's code review that makes me write in a maintainable style. It's the team that's responsible for a code base and objections are raised whenever anyone thinks that they'll struggle to understand this or that line. We also enforce consistency. Yes, you _can_ choose any character for quoting lists, but for the love of Pete, you _will_ follow how it's done in every other case (in that file, at least).
yeah, raku takes the perl functional heritage and adds a bit
my $logger = -> $m { say $m; $m };
my $add-five = -> $x { $x + 5 };
my $add-five-and-log = $add-five o $logger;
say $add-five-and-log(25); # Prints 25, then prints 30
Surprisingly (but not really), I found myself in a position to harness my late-90s perl for cgi experience for the sciences after bioinformatics began to take off.
Python makes quite a few things easier if only because of how "teachable" it is between colleagues, but the really useful tools that bear more in common with the human relationship with data as text-at-scale were part and parcel to the POSIX-likes. The biggest challenges I faced were getting IT to let me use Linux at work and convincing peers to try it.
> perl6 - now renamed to www.raku.org, continues the spirit ...
With perl7 still being worked on, is it really a continuation or they're just branching off? I'm still not sure what's their relation to each other now. Why would one choose to use perl over raku or vice-versa?
My understanding is that there is Perl 5 (which is Perl) and a completely separate language known as Raku that was originally supposed to be Perl 6. This happened as Perl 6 took so long (similar to Duke Nukem Forever) that large portions of the Perl community decided it wasn't a realistic upgrade path and the languages had a hard fork.
Perl7 seems to be Perl5 with some changes to the defaults. They can't upgrade to Perl6 as that would be needlessly confusing. If foresight were perfect, Perl6 would have always been a different language name so Perl proper would continue without confusion. The problem was that they had no idea how hard it would be to make Perl6 and thus thought it would be ready in a few years (my understanding) and everyone would upgrade. Raku/Perl6 is SERIOUSLY COOL. I think it just needs a larger community and that's a chicken/egg problem.
Perl 6 was intended from the start to be the next major release of Perl (at various times, a replacement for a 5.10 or 5.12 or 5.14), and it was intended to have a backwards compatibility mode to run 5.8 (or 5.10 or 5.12) code in the same process, with full interoperability.
As time went by, that plan became less and less likely. Some people came up with the idea that Perl and P6 were "sister languages", both to have new major releases. I think this happened sometime around 2009 or so, maybe as early as 2007.
Also by 2011 or so, the P6 developers effectively scuttled the backwards compatibility plan and code written to that point, but I've argued that their plan to replace Parrot was a mistake enough here and elsewhere already. (Sometimes I wonder, now that MoarVM is older than Parrot was when Parrot was declared unsuitable, if they've achieved their promised speed and compatibility goals.)
Well the raku community may be small (1300 ish on reddit) but it is very welcoming and there is lots to help out with (RakuAST anyone?). There are 2200 or so modules on www.raku.land (plus Inline::Perl5, Inline::Python, CFFI and so on) - I learn something every day by rubbing shoulders with some amazing experts!
I like perl. Before, I had written a toy web server in perl (it was fun and I learned a lot), then I ported it to cosmopolitan to have it run everywhere!
This year I've written a fdisk replacement in perl, to make hybrid MBR+GPT for bootable media.
First, I wanted to check how they were made, but then I decided I wanted to programmatically write hybrid MBR in a way that's easier than gdisk and that offers more control that xorriso.
It's not complete yet, but the partition reading feature was already very helpful to understand the ins and out of the mfg59 layout that's so popular for optical media, and the final gpt tweaks should only take a few more days.
perl allowed me to write it very quickly and to make sure it will work reliably for the years to come.
Bummer you’d been downvoted for that. It sounds like quite the ambitious project that you’ve nearly got working. Cool!
But I’m also saying this while holding a sharp stick and slowly backing away. That is not the sort of thing I’d expect someone to write in Perl, and I’m experiencing an odd mix of “that’s amazing!” and “what on earth were you thinking, my friend?!”
Some people have an instinctual dislike of things they've been told it's fashionable to hate. I resent that, because all programming languages are interesting in their own ways.
> It sounds like quite the ambitious project that you’ve nearly got working. Cool!
Oh it's already working, it just needs more polish :)
> That is not the sort of thing I’d expect someone to write in Perl, and I’m experiencing an odd mix of “that’s amazing!” and “what on earth were you thinking, my friend?!”
I wanted to do it quickly :)
For decoding weird formats that mix little and big ending, I think perl unpack/unpack is the fastest way.
Also, for computing crc32, I didn't have to bother much :)
Man. I really wish we didn't have language discrimination. Perl is just so fast to write and has such a sizeable ecosystem of modules, and such great docs, that I can produce any program in Perl faster than I can write it in Python, purely because it's more expressive in a smaller space and has fewer restrictions. But no team I'll ever be on in my life will agree to work with me on a Perl project, because everyone just "knows" Perl is taboo. People laugh at me when I suggest using it.
The best thing about Perl in comparison to Python is that programs written in Perl age very well. You can run decades old scripts without any updates, versioning and/or dependency hell or other headaches. Even better, also across platforms. I stopped using Python because of the anti-experiences with all that.
Was thinking that sounds strange, but that's because 90% of my Python is done in Django (which has excellent docs). Python's own documentation is horrible to read for some reason. Whenever I need to remind myself of how to use regexes in Python, it's the first place that comes up, followed by finding a tutorial elsewhere.
I’m with you there. I don’t hate Perl. I don’t think it’s taboo. I just can’t think of a scenario where I’d want to use it over another tool.
Perl was the first non-C language I wrote significant amounts of Unix code in. In particular, I wrote lots of web and server admin projects with it. I know Perl well enough to 1) appreciate why people still like using it, and 2) not want to use it myself.
I used to write in Perl 20 years ago. It started really nice, with well-structured code.
And then when I learned this and that, the code started to be more concise, to the point of being impossible to understand for the author (me) after a week.
I liked it though and I realize that this is not Perl's fault but mine. Still, giving too much power to less experienced devs without having them unlock some kind of experience badge is dangerous :)
Perl is a beautiful language. It’s fast. It’s stable. It’s expressive. What I really miss working with other languages is Perl’s documentation.
Bigots gonna bigot. Perl is an unorthodox language; Larry would probably prefer eclectic. It’s tough being the different kid. As paulg wrote, “The superficial demands of orthodoxy make it an inexpensive substitute for virtue. And that in turn is one of the reasons orthodoxy is so attractive to bad people. You could be a horrible person, and yet as long as you’re orthodox, you’re better than everyone who isn’t.”
Perl usually had excellent quality modules back when I was using it. Python (these days) has a mix of mostly good, but some bad. Javascipt just seems a shambles when I go there.
The thing is, they stayed the same, same 13 years old bugs, sometimes you can even see the author popping in saying he’ll take a look in February without narrowing it down to at least the quarter century said February is supposed to be in.
The usual ghost town with tumbleweed on its streets.
that's not just a perl problem. you may face the same issue with php and also any lesser known language, if only for different reasons. either way though, popularity wins
The very short format is useful for reminders of what is possible, flagging features that I'd skipped over when they first came out (iterating over multiple values at a time, i.e. a hash in a foreach loop). You need to go elsewhere to get the significance of new features to the language, such as "class" or subroutine signatures.
It's the best format of reference I've seen for the times I'm asking myself what's the minimum version of Perl needed for this bit of code and what becomes available when ops upgrades the production server.
Perl5 it's like merging an enhanced ksh, easier awk and less difficult sed in a single tool.
It can do the same exact thing as the previous three but with less headaches.
Except acting as an interactive shell as sh does, OFC.
Also with CPAN you have lots of nice tools out there.
Perl's still got a special place in my heart, but honestly, I don't use it much these days. I mainly bring it out when I'm processing a lot of text or writing scripts to be used by Perl-savvy teammates.
But here's a cool thing - in coding interviews for non-SWE roles (I'm in security), when they say 'pick any language', I go straight for Perl. Why? Because it's very forgiving when prototyping a solution quickly, has great data-structures without a lot of setup (auto-vivification!), built in grep and map features, etc.
10 Years ago there was the so called Perl Renaissance.
Which should turn Perl around. Sad truth is.
People already moved on.
Everything to little to late and not what the people where looking for.
I started a new Perl project 7 years ago and it has been an ecstatic experience for me. It is basically a text processor and HTML generator, so Perl has all the features I need. I am so happy, and I'm not even using anything beyond 5.010. I'm at 32K+ LOC now, and I'm also using the project to teach programming to Ukrainian kids over Zoom.
Number of breaking changes I have experienced in these 7 years? 0.
Number of times I've had any significant issues setting up a new deployment? 0.
It may not be as popular, but it certainly continues to work well.
Yep. The fact that 100% of the code I've written in Perl since the beginning of this century still works just fine year after year with each new release is an immense bonus. I have deployment scripts written on Debian 3 still running in cron "as is" 20 years later, zero maintenance. Try that with Python, PHP or Ruby...
There's some nice stuff in the new features and everybody has their favourites. Some like the subroutine signatures, but I'm a big fan of the hash slices and postfix dereferencing in v5.20.
I don't get this line of criticism. Perl is a dynamic language and it gives you a lot of flexibility and allows you to add things you think you need.
It's not like Java/Go/Rust where you really have to wait for new syntax in the language.
I think maybe whoever thinks like this about Perl shouldn't have been using it in the first place because they needed something different, like a strongly typed language.
Php startet as a Perl framework. Ruby is direct reaction to Perls inability to evolve (Perl autobox is great. Why not in core). There is Python.
I love Perl. Use it daily. I used Moose, mouse, any::mouse and was excited about p5-mop. But there is no traction in change.
Also fact is Perl has a bad image and Perl gets patched out of all projects.
I don't know why you're being downvoted. It's the truth. Back in the 90s many of us invested hundreds of hours mastering Perl and post 2008 ended up using Python/Ruby/etc more frequently for various reasons and now speaking for myself I can barely decipher a line of Perl. It's syntax is extremely hard to maintain in memory when you stop using it.
if people leave perl because of the syntax then a perl renaissance was not going to stop that. the change that had a chance to make the syntax more attractive was perl 6/raku.
For me, it was the argument passing syntax. I had to look up the magic sigil for doing hashref stuff every single time.
One day I tried Python, learned that everything is passed by object reference, and set Perl aside and never looked back. There was so much less mental overhead that Perl never lured me back.
That's because it didn't work reliably. There were at least a couple of situations where Perl would have had to guess which operation you were trying to perform, so the feature was a source of potential bugs.
In tables without borders and/or margins, you can never tell where each feature starts or if there’s one or two of them when the text wraps. Not sure what drives people to use tables at all for title:content or feature:description lists.
Each row has 2 columns. Does the left column ever wrap? I don't see it wrapping because it's pretty narrow. Because the left column never wraps, you can use the left column to determine when a new row begins in both columns.
Hmmm, I haven't looked at Perl in ten years and my day-to-day for the past seven years has been Python with occasional Java. I was a fan, but now I don't miss Perl.
Perl is a more expressive more fun language, but I do find that the more restrictive nature of Python leads to me writing better, if a bit more verbose code (better as in more readable and maintainable). I would start something in Perl using a few fancy tricks, then come to hate my "clever idea" a few days later when trying to debug it. I do miss it though.
I know a lot of folks who feel the same way about python (it's too dynamic and encourages unmaintainable code). It's a continuum; to me it's amazing how well python hit the sweet spot.
It's just a reference list for the people who know half the features already. If you want a readable list, try the Table of Contents in "Perl new features".
that's not an excuse for poor formatting, especially when not breaking just a couple of formatting rules would make it a better reference, and doing a couple of more tweaks would make it an even better reference (e.g., you could easily see all experimental features with a simple tag in a column instead of having to reach the end of each description)
It has other surprises, like unexpected list contexts eating your undefs, serializing modules determining whether a scalar is considered numeric or string depending on which reading operation accessed it last, also perpetual uncertainty footgun whether a given string is bytes or unicode by some popular modules.
It's a language implementation gotcha, not really a library problem. The internal data structure used to represent values is polymorphic and uses flags to represent the types of operations performed on the represented data (numeric, string, etc).
The only reliable way to serialize a value with a desired type is to request that type explicitly--as one might do to represent a large integer or very precise decimal in JavaScript or JSON, for example.
Well, JSON::PP and Cpanel::JSON::XS don't have this problem somehow.
The fact that they need to literally fortune-tell from Perl guts if something is a number or a string is telling as literally every other mainstream language including current dialects of Pascal has this problem solved. But I'm most unimpressed by the fact that merely looking at a variable will mutate its internal representation enough for there to be externally-visible effects.
It doesn't matter if JSON::XS is looking at the internals wrong, or if it's Perl's behavior at fault: from whichever angle you look at it, the whole thing is a tangled mess of wrongness.
JSON::PP and Cpanel::JSON::XS don't have this problem somehow.
From my reading of the documentation of the former (especially the MAPPING section), it has the same problem for the same reasons.
the whole thing is a tangled mess of wrongness
Perl has monomorphic operators and polymorphic values. Every time someone tries to flip that, whether encoding arbitrary data structures to monomorphic values via a polymorphic visitor pattern, the smart-match experiment, or (as I already mentioned in this story's comments) polymorphic operators for data structure dereferencing, these problems occur.
Regardless of whether anyone believes that Perl's operator/value design is good or useful, that's how the language works. Working at cross purposes is an exercise in frustration. (I'll leave analogies about duck typing, contravariance, casting, and type erasure to people who like debating programming language design.)
~ perl -MJSON::XS -E 'my $d = {foo => 42}; say encode_json($d); $d->{foo} eq "bar"; say encode_json($d);'
{"foo":42}
{"foo":"42"}
~ perl -MJSON::PP -E 'my $d = {foo => 42}; say encode_json($d); $d->{foo} eq "bar"; say encode_json($d);'
{"foo":42}
{"foo":42}
~ perl -MCpanel::JSON::XS -E 'my $d = {foo => 42}; say encode_json($d); $d->{foo} eq "bar"; say encode_json($d);'
{"foo":42}
{"foo":42}
So it seems either the documentation is now wrong, or the assumptions about "usage" are wrong except for JSON::Xs (on Perl 5.32.1).
However, it "works as documented" when the implicit conversion is the other way around:
~ perl -MCpanel::JSON::XS -E 'my $d = {foo => "42"}; say encode_json($d); $d->{foo} == 0; say encode_json($d);'
{"foo":"42"}
{"foo":42}
> Every time someone tries to flip that, whether encoding arbitrary data structures to monomorphic values via a polymorphic visitor pattern, the smart-match experiment, or (as I already mentioned in this story's comments) polymorphic operators for data structure dereferencing, these problems occur.
Nothing in the typelessness of the language, though, makes it necessary to flip any internal state of a variable, though, any time its usage context changes. Especially if the state is readable by public API. Even in a typeless language, the "primary" type of the thing, if it's queryable by anything at all, should intuitively be what it's being set to by assignment or other kind of explicit mutation.
NB: that’s not a perl.org website. It’s someone’s blog.
Now, I have touched Perl in decades (oof, that’s rough to type) and that someone might be the official Perl leader for all I know. I don’t think it is, though.
The Perl Foundation co-ordinates activities such as grants funding development, fundraising, and conference organizing. https://www.perlfoundation.org/
There are also a few senior Perl personalities still around such as brian d. foy who continue to write and update books and blogs.
The post-Larry Wall community seems to be doing ok so far. What is notably missing is more active participation from companies making the most use of Perl such as Craigslist or Duck Duck Go.
https://blogs.perl.org/users/dimitrios_kechagias/2022/11/per...
I still code in Perl a fair bit for work. One great improvement I have taken advantage of is subroutine arguments, rather than unpacking @_ at the head of each subroutine. It is much easier to tell what the sub expects, and if the caller passes the wrong number of args it is a compile time error.
The main draw for me is that regex is built into the syntax of the language, and not a library. If the task requires a lot of pattern matching and string manipulation and speed isn't that critical, I reach for Perl.