News for hackers. Stuff that matters.
Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by jmclnx on Wednesday October 01, 2025 @01:41PM (#45440637)
Very nice, I should get off my butt and learn Perl. That is part of a multiple decade procrastination process :)

I got close 20 years ago, but "things".

Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by bastardoperator on Wednesday October 01, 2025 @01:50PM (#45440781)
Started with Perl, always loved it, never understood the hate. I feel like after Perl you can write in any language. I'll never forget writing Python the first time and searching for a Data::Dumper alternative...
Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by kstrauser on Wednesday October 01, 2025 @02:44PM (#45441571)
For me personally, the biggest pain points that drove me to Python were:

1. Sigils, and relatedly, contexts. In my opinion, `my $length = @list;` is a horrid way to spell `length = len(list)`. It feels too much like typecasting magic.

2. Having to opt in to pass by reference caused so much pain. You're happily passing a hash around, but then you want to do something to it, so now you have to change the type signature of the function, then everything that calls it, etc. etc.

Contrast with Python, where everything is pass-by-object-reference and sigils aren't needed because contexts in the Perl sense don't exist. This worked on my first try:

  >>> a = ["foo", 123, {"bar": [(1,2,3), {"qux": "quux"}]}]
  >>> a[2]["bar"][1]["spam"] = "eggs"
  >>> import json
  >>> json.dumps(a)
I liked Perl. I wrote a lot of Perl. And yet, I still had to pull out The Book whenever I wanted to do anything more complex than passing a couple of ints or strings around. This stuff is knowable, obviously, but I just got tired of having to know it.
Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by hackthemack on Wednesday October 01, 2025 @05:01PM (#45443483)
Programming is such a strange field with so many people with different mental models. I am no fan of Perl, but I think having a function pass arguments as copies (and then also having semantics to work on the original by reference if you want to) is very handy. Passing copies reduces side effects.
Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by kstrauser on Wednesday October 01, 2025 @06:25PM (#45444304)
There are any number of ways to skin that cat. In Rust, for example, values you pass, whether by value or by reference, are immutable by default. You have to explicitly mark them as mutable in the receiving function signature to allow mutation. I freaking love that as a default. Passing by reference is trivially easy, but you still avoid accidentally altering things that ought not be frobnicated.
Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by davidschultz on Thursday October 02, 2025 @02:06PM (#45453225)
In this case it might interest you to learn that in Raku (Perl 6), the values passed to a function are also by default immutable within that function.

If one wants the function to mutate them, one has to explicitly mark them as `$x is rw` in the function signature; this then requires one to always pass a mutable container for $x. (A bit more detail: https://andrewshitov.com/2019/10/15/110-is-rw-vs-is-raw-in-r... )

Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by kstrauser on Thursday October 02, 2025 @03:26PM (#45454260)
That's a nice improvement, to be sure!
Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by Ultimatt on Thursday October 02, 2025 @12:47AM (#45446396)
I haven't touched Perl in about ten years but your example is kind of insane. This is the one place Python is more annoying than Perl???

    my $a = ["foo", 123, {"bar" => [[1,2,3], {"qux" => "quux"}]}];
    $a->[2]{"bar"}[1]{"spam"} = "eggs";
    use JSON;
    print(encode_json($a))
That's the same as your example (minus the tuple type), but where Perl shines over Python (a lot) is you could have done the following:

    use JSON;
    my $a = [];
    $a->[2]{"bar"}[1]{"spam"} = "eggs";
    print(encode_json($a))
which would yield the json: [null,null,{"bar":[null,{"spam":"eggs"}]}]

To do this in Python is truly grim:

    import json
    from collections import defaultdict

    # recursive defaultdict using lambda
    datastructure = lambda: defaultdict(datastructure)

    a = [None] * 3
    a[2] = datastructure()
    a[2]["bar"][1]["spam"] = "eggs"

    print(json.dumps(a))
and thats doing it the unpythonic way, if you were to do this like the typical Python dev would accept in an MR for a large corp you would have written:

    import json
    from collections import defaultdict

    def datastructure():
       return defaultdict(datastructure)

    a = []
    # expand list to at least length 3
    while len(a) < 3:
       a.append(None)
 
    a[2] = datastructure()
    a[2]["bar"][1]["spam"] = "eggs"

    print(json.dumps(a))
They would still hate you for defaultdict(datastructure) though. Because absolutely no one in Python realises its got that level of expressionism one of the few places it does.
Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by kstrauser on Thursday October 02, 2025 @11:14AM (#45450809)
Why is there an arrow between $a and [2], but not between [2] and {“bar”}, in this?

  $a->[2]{"bar"}
The highest rated SO answer here explains a little, and it’s the kind of situational nitpickiness that let to me dropping Perl like a hot potato when something better matching my mental model came across my radar: https://stackoverflow.com/questions/1817394/whats-the-differ...
Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by Enk1du on Monday October 06, 2025 @06:33AM (#45489838)
I suppose it's because very soon people got tired of writing

  $a->[2]->{"bar"}
which is equivalent and also works, but suffers from the explosion of punctuation that Perl often gets criticised for. There's an element of Do What I Mean where the first arrow says this is a reference and work the rest out for me.
Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by odc on Monday October 06, 2025 @08:45AM (#45490767)
In Perl -> is the dereference operator, similar to C.

So when you see

    $a->[2]{"bar"}
then $a is an array reference where each item is a hashmap. But with

    $a->[2]->{"bar"}
then $a is an array reference where each item is a reference to a hashmap.
Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by zaucker on Tuesday October 07, 2025 @04:20PM (#45508317)
$a->[2]->{"bar"} is the same as $a->[2]{"bar"} or as $a->[2]{bar}
Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by athenot on Wednesday October 01, 2025 @02:13PM (#45441121)
Same here. Perhaps what I've enjoyed the most about Perl was the humanness and art of it. Cleverness and expressiveness were at the service of elegance.

Sure you can write amazingly obscure foot-guns in Perl but that's also true of any other language. But honestly I'd rather a few lines of obscure Perl code WITH a comment block explaining why, than a dozen classes with bits and pieces of business logic spread all over the place.

Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by samoit on Wednesday October 01, 2025 @02:41PM (#45441530)
I think that "hate" comes from the "write once" language fact. Perl is quite cryptic to read... even if it is your own script. That's why raku appeared
Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by rurban on Thursday October 02, 2025 @01:14AM (#45446507)
Which is even harder to read
Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by mrweasel on Thursday October 02, 2025 @05:12AM (#45447642)
Perl was on my "want to learn" for 25 years. This year I finally had a project that really only could be in Perl, due to a library dependency, so I was kinda forced. It has been an fun and pleasant experience.

I've done a few small Perl script in the past month, mostly just to try out things and learn a bit more. I'm surprised how robust the code turns out, without me trying. The Perl syntax is a little all over the place at times, but it's incredibly powerful.

Overall it's probably not a language I'd use at work, unless I have to, but for hobby project I would pick Perl again. It has put some of the fun and humanity back in programming.

Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by pfexec on Wednesday October 01, 2025 @02:33PM (#45441413)
I love that many of the scripts in the OpenBSD base system are written in Perl.
Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by sciolizer on Wednesday October 01, 2025 @02:20PM (#45441214)
`man perl` and `man perlintro` are the easiest way to get started. Not sure about Raku.
Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by reddit_clone on Wednesday October 01, 2025 @02:30PM (#45441359)
If you already know Perl, Raku is easy to pick up. Especially for basic text munging tasks. The RegEx stuff has changed though. Takes some getting used to.

Some of the warts are gone (like a list element needs to have a scalar context, the stuff that scares away beginners).

It is a _large_ language with paradigms and constructs that are from everywhere (ML, Haskell, Lisp, C, Perl you name it).

Powerful operators. Actually too powerful. Easy to write elegant line-noise kind of code.

Easy to use built in concurrency. (There isn't much that is not built in :-) )

Nice language for Sys/Ops scripting if you find Bash too dangerous and Python too tedious.

Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by davidschultz on Thursday October 02, 2025 @02:11PM (#45453283)
The book by Moritz Lenz is quite good. https://link.springer.com/book/10.1007/978-1-4842-6109-5

There's also this polished three-hour introductory lecture: https://www.youtube.com/watch?v=eb-j1rxs7sc

Combine that with reading up on details in the reference and you're in for a decent start. https://docs.raku.org/reference

Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by neuroelectron on Wednesday October 01, 2025 @04:09PM (#45442767)
If you don't have a reason to use it then I don't know why you would but I think it's the best tool if you're using Linux. It's certainly better than using shell commands and managing various syntaxes between shells and command lines.
Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by Razengan on Wednesday October 01, 2025 @02:17PM (#45441169)
I still got "Learn 6502 Assembly for the Commodore 64" on my backlog.

That said, how does DuckDuckGo get that money?

Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by 7thaccount on Wednesday October 01, 2025 @02:30PM (#45441360)
Me 2! Been in my closet for years. It was a gag gift.
Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by 8s2ngy on Wednesday October 01, 2025 @01:54PM (#45440827)
Kinda similar—Raku is on my radar. I won't have time to take a look at it this year. Maybe it can become my next year's resolution. :)
Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by reddit_clone on Wednesday October 01, 2025 @02:20PM (#45441221)
Raku is amazing. It is great for writing System/Ops scripts with easy built in concurrency!

Its only fault is, it has too much stuff in it.

Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by 7thaccount on Wednesday October 01, 2025 @02:33PM (#45441411)
Not just too much stuff IMO. I kind of like all the features.

The main problem in my eyes is not enough volunteers (although they are doing a superhuman effort) to get it into the production level it needs to get more widespread adoption. The other problem is that Python already has a huge amount of libraries and is considered to be "good enough" feature wise, so it's hard to attract interest.

I do enjoy reading Raku code and think it is super neat as this do it all post-modern language. Inertia is hard to overcome though.

Re:DuckDuckGo Donates $25,000 to The Perl and Raku Foundatio... by reddit_clone on Thursday October 02, 2025 @03:00PM (#45453906)
Early on, there was some attempt at syntactic macros. I tried it. But it didn't work out. I hear there are efforts for another iteration. That would be just fantastic when it lands.