hi, i was interested if perl is still relevant in this day and age. Perl has been on the decline for a very long time now. Perl 6 (now named 'raku) not being backwards compatible with perl 5 code made the already small perl community even smaller by splitting it in half. A good example is lisp with it’s thousands of different dialects.

Is it still worth using or is it bound to legacy software forever? Like cobol.

  • @[email protected]
    link
    fedilink
    English
    41
    edit-2
    10 months ago

    For me, Python replaced Perl 15 years ago. I know Perl is a great language, but it’s too “write-only.” Python replaced both BASIC and Perl at the same time, even with the problems of migration from v2 to v3. Python can also do scripts to replace Bash and PowerShell. I don’t see myself learning Perl now, it would be a waste of time.

    Perl was revolutionary at the time with CGI and regexes, but it’s not needed anymore.

    • El Barto
      link
      fedilink
      English
      14
      edit-2
      10 months ago

      I wish python was not indentation aware. It has discouraged me from learning it.

      Edit: downvoted by fanbois. Look, I’m not married to my tools.

      • @[email protected]
        link
        fedilink
        English
        2810 months ago

        Even if you’re writing JavaScript, you should be using proper indentation. What an odd thing to keep you from learning it.

        • aard
          link
          fedilink
          English
          810 months ago

          I write code, indentation is something that the editor just does automatically. If I want to change indent settings I just mark the complete buffer, press tab, and magic happens.

          I’ve been using python for various stuff for a few years now as well, and the indent thing still annoys me.

        • El Barto
          link
          fedilink
          English
          410 months ago

          Sometimes I want to write a quick oneliner or a quick algorithm to test things out. Or not worry about indentation when trying a solution I might discard in five minutes.

          With Python, I don’t have that choice.

            • El Barto
              link
              fedilink
              English
              1
              edit-2
              10 months ago

              Single line ID? What do you mean?

              Edit: I got it now.

              So I can place multiple for loops and conditional statements in one single line in Python?

              • @[email protected]
                link
                fedilink
                English
                310 months ago

                List comprehension can actually do that, yes. This is one of the scripting aspects of python I use most commonly, and is probably one of its best-known features for creating “one liners”.

                • El Barto
                  link
                  fedilink
                  English
                  1
                  edit-2
                  10 months ago

                  I read about it since I was curious. It seems like you have to craft your code in a certain way for it to be a one-liner. Whereas with many other languages, you don’t need to do such a thing. You just put everything in one line and off you go.

                  Having said that, from a challenge-seeking perspective, writing python oneliners sound fun (I really mean this.)

              • @[email protected]
                link
                fedilink
                English
                210 months ago

                I think it’s an autocorrect typo. Should be: If it is actually a single line, I’d argue that you do.

        • @[email protected]
          link
          fedilink
          English
          210 months ago

          Things get messy though, when you have to break the rules of indentation once in a while or when you have “improper “ indentation. Whitespace is a stupidly messy thing. Indentation should be a style guide, not part of the language semantics.

        • @[email protected]
          link
          fedilink
          English
          0
          edit-2
          10 months ago

          No, it really is horrible. I’m an old timer who learned on FORTRAN and other languages that were still suffering from the punchcard era. Making logic based on character positioning, and adding unnecessary restriction, is just so frustrating and tedious. We got away from such constraints by the 1990’s. Let’s not go back.

          Sure enough, my kid’s Comp Sci teacher tried to use Python because he read how easy it is to use, but no one succeeded because of the formatting. No one succeeded except my kid, who also became a rock star by helping kids reformat. Anyhow, back when computers were primitive and limited, such restrictions were understandable. They’re not anymore.

          Currently I’m a fan of Groovy. All the capability of Java without silly requirements like semi-colons. All the simplicity of Python without silly formatting restrictions

      • @[email protected]
        link
        fedilink
        English
        2410 months ago

        If that’s your only reason, I’d encourage to try it anyway. Logical indentation is initially weird but it can be overcome very fast.

      • @[email protected]
        link
        fedilink
        English
        610 months ago

        It has never been an issue for me in 20 years. If you move code, you cut a whole paragraph, paste, and indent appropriately.

        • El Barto
          link
          fedilink
          English
          -310 months ago

          If I move code in non-python code, I cut a whole paragraph, paste, and I’m done if that’s all I wanted to do.

          • @[email protected]
            link
            fedilink
            English
            -110 months ago

            Your code won’t be indented properly, same problem as Python unless you have a formatting tool in your setup.

            • El Barto
              link
              fedilink
              English
              1
              edit-2
              10 months ago

              It won’t matter. It will still compile correctly every time, as opposed to python, and that’s my point. Choice. Choice is the key here.

                • El Barto
                  link
                  fedilink
                  English
                  110 months ago

                  I know Python is interpreted, but regardless, my point still stands. Just replace compile with run correctly.

      • @[email protected]
        link
        fedilink
        English
        410 months ago

        I wish python was not indentation aware. It has discouraged me from learning it.

        lol, then you just don’t like Python. You can’t disassociate the two things.

            • El Barto
              link
              fedilink
              English
              1
              edit-2
              10 months ago

              Correct. I don’t think we’re disagreeing. The language has one deal-breaker to me and that’s all I need to know.

              That’s like saying “you won’t be friends with Bob because he’s likes to go to smoking-friendly places all the time and you don’t? BUT YOU DON’T KNOW THE GUY!!!”

  • magic_lobster_party
    link
    fedilink
    1610 months ago

    Perl is great for that occasional bash one liner or that one off script.

    It’s awful for team projects. The core mantra of Perl is “there’s more than one way to do it”, meaning every piece of code can be written in hundreds of different ways. Result is that everybody write with different code styles, and no one can understand each other’s code.

    So that rules out most practical use cases.

  • @[email protected]
    link
    fedilink
    English
    1210 months ago

    I write Perl at work. Supporting an actively developed Perl based application.

    It’s honestly not that bad as a language, the biggest downside is that the ecosystem of libraries around it are often abandoned or outdated. The language isn’t perfect and it needs a bit of discipline to avoid creating unreadable code, but honestly it’s not as bad as its reputation might have you believe.

    It has quite a few tricks and unexpected bits of flexibility that make it quite a bit more expressive than other languages - you can really craft nice compact, elegant code with it if you want to.

    These days I use other languages too (Python, Ruby, JS, etc) but none of them quite match Perl for expressiveness.

    Oh also it’s great for oneliners. That expressiveness can be abused for brevity in some really interesting ways.

    • @[email protected]
      link
      fedilink
      English
      410 months ago

      unexpected bits of flexibility

      The worst one I stumbled across while reading a colleagues script was the three separate namespaces for symbols of type scalar, array, and hash.

      • @[email protected]
        link
        fedilink
        English
        1
        edit-2
        10 months ago

        You mean the fact that you can have a hash called %foo, an array called @foo and a scalar called $foo all at the same time? I agree that’s a weird choice and there’s potential for insanity there, but it’s pretty easy to just not do that…

        20+ years of Perl experience and while Perl has a load of idiosyncrasies that make it harder to work with than other languages, I don’t think that particular one has ever caused a significant problem.

        • @[email protected]
          link
          fedilink
          English
          1
          edit-2
          10 months ago

          You mean the fact that you can have a hash called %foo, an array called @foo and a scalar called $foo all at the same time?

          Yes, exactly. Those definitions aren’t clashing, so they must have separate namespaces.

          it’s pretty easy to just not do that…

          I wouldn’t do that either, but my colleage apparently did. So far I’m having a harder time reading perl than writing it.

          • @[email protected]
            link
            fedilink
            English
            110 months ago

            The way it works is that there’s a symbol table entry for “foo” which has a slot for a hash, scalar, array, glob, etc.

            That leads to some super weird behaviour like, for example, if I declare a scalar, hash and array as “x”:

            $x = "sy";
            %x = (foo => "mb");
            @x = ("ol", "s!");
            

            You can access them all independently as you’re aware:

            say "x: ", $x, $x{foo}, @x; # Outputs:  x: symbols!
            

            But what’s really going to bake your noodle is I can assign the “x” symbol to something else like this:

            *z = *x;
            

            …and then the same thing works with z:

            say "z: ", $z, $z{foo}, @z; # Outputs:  z: symbols!
            

            Oneliner if you want to try it:

            perl -E '$x = "sy"; %x = (foo => "mb"); @x = ("ol", "s!"); say "x: ", $x, $x{foo}, @x; *z = *x; say "z: ", $z, $z{foo}, @z;'
            

            Congratulations! You now know more about one of Perl’s really weird internals than I’d wager most Perl programmers (I have literally never used any of the above for anything actually productive!)

      • @[email protected]
        link
        fedilink
        English
        310 months ago

        Nope. But I know a bunch of people that do or have, and have interviewed several (it’s a pretty small sector!)

  • @[email protected]
    link
    fedilink
    English
    1210 months ago

    Perl hasn’t lost any of it’s qualities or relevance or usefulness.

    It’s just, with these incompatible language upgrades, they are creating artificial barriers for starters and for occasional users. The outcome is that they are making it less popular, sadly.

    • @[email protected]
      link
      fedilink
      English
      110 months ago

      Which incompatible language upgrades? Are you talking about Perl 6?

      That was never really an iteration of Perl, and it was renamed Raku some years back so is no longer named like it’s an iteration of Perl.

      Perl continues as Perl 5 and honestly values compatibility extremely highly, probably more than many (most?) other languages. There have been a handful of breaking changes over the years (most notable for me was the hash key ordering thing) but those are usually security related rather than anything else.

  • @[email protected]
    link
    fedilink
    English
    810 months ago

    The community is all but gone at this point. It used to have a lot of highly concentrated competance. Many of those people left (or were driven away) in the last few years, and nobody is taking their place.

    There is no such thing as a junior Perl programmer.

    My company still uses it significantly, and has already had one major failed attempt to get rid of it. I expect we’ll still have it for years to come. I’m at least 25 years away from retirement, and I wouldn’t be surprised if it was still around then. That said, we’re moving to Elixir, and with a much better plan than the previous attempt.

    All that said, we gobble up all the experienced Perl devs we can and try to make them happy enough to stay. There’s good money to be made in a long-tail language.

  • @[email protected]
    link
    fedilink
    English
    710 months ago

    I work at a small company that still uses perl for everything. It works, the company makes money. They’ll never move off it. I bet there’s a lot of little places like that, but I doubt many are starting new projects with it. Not many of the major modules have a lot of updates recently, but they’ve also been pretty complete for a long time. If you already know shell/awk/grep/etc it’s pretty easy to pick up. Probably will see less and less of it as the people that do write in it continue to age.

    • @drzow
      link
      English
      310 months ago

      Personally, I never figured out awk and sed, and only the basics of heel because I’ll just use Perl if I need and if the things those tools do.

      You can do cool and complex stuff with it (I have), but it’s really unparalleled for folding, stapling, and mutilating text in a CLI environment.

  • El Barto
    link
    fedilink
    English
    710 months ago

    Is Raku really used as much as perl? Splitting the community in half is quite the claim…

  • Hovenko
    link
    fedilink
    English
    610 months ago

    OpenQa testing framework still uses perl heavily.

    I learned perl after python and I still like the language. At the end I always treat languages as tools. There is no bad language. There is only a task and your decision to pick the correct tool for it.

    • El Barto
      link
      fedilink
      English
      810 months ago

      The illegible code claim has always baffled me.

      You can write perfectly legible code in perl. You can write illegible code in python if you really want to.

        • El Barto
          link
          fedilink
          English
          110 months ago

          Define “people”. People you work with? Old codebases from your workplace?

          Well, from my experience, people don’t write illegible perl code.

      • @[email protected]
        link
        fedilink
        English
        310 months ago

        The variable prefixes make it easy in Perl to write line noise, and there are much more “magical defaults”.

        What’s the most illegible code you have found in Python?

        • El Barto
          link
          fedilink
          English
          110 months ago

          How is type information noise instead of a helpful feature?

          I haven’t looked for illegible Python code out there.

      • @[email protected]
        link
        fedilink
        English
        -110 months ago

        Writing legible Perl code is the complete antithesis of what the language was created for. This comment shows a complete misunderstanding of Larry Wall’s work.

        • El Barto
          link
          fedilink
          English
          010 months ago

          Lol what are you talking about?! What is this LW’s point you’re referring to? “Write non-readable code, everyone”?

          I’m guessing you’re referring to him saying “there’s more than one way to do things”, and that’s not mutually exclusive from writing legible code.

            • @drzow
              link
              English
              110 months ago

              There’s an obfuscated C contest too - no one ever assumed that K&R opposed highly legible code. I seem to recall that Kerrigan actually wrote some books to the contrary.

            • El Barto
              link
              fedilink
              English
              010 months ago

              That’s a non-argument, man. You just linked to a contest.

              That’s like saying that the FAA endorses unsafe airplane building practices because they hold a contest about unmanned cardboard made planes that fly the most length in a desert without crashing.

  • r00ty
    link
    fedilink
    510 months ago

    I use perl for automation stuff that needs more than bash, but doesn’t require the speed of a faster/compiled language. In my opinion it’s great for that kind of thing.

  • @[email protected]
    link
    fedilink
    English
    3
    edit-2
    10 months ago

    I know of at least one big online company that still has a staggering amount of perl in their stack for 2023 (IMO)

  • @[email protected]
    link
    fedilink
    English
    210 months ago

    I played around with Perl when I was still in school, almost 20 years ago. Even then it was pretty legacy. I remember fixing a bug in a Perl script during an internship, because I was literally the only person in the whole department who could understand Perl code. I suppose it was used for sysadmin and web scripting but has since been replaced by PHP, Javascript and Python. I wouldn’t bet any money on Perl being relevant in the future.

    • @[email protected]
      link
      fedilink
      English
      310 months ago

      It was used for everything in the late 90’s. I get nostalgic when I see a bit of perl on the web these days, but I sure don’t miss it.

    • @[email protected]
      link
      fedilink
      English
      510 months ago

      It’s “its”, not “it’s”, unless you mean “it is”, in which case it is “it’s “.

      • r00ty
        link
        fedilink
        510 months ago

        Back in the days when we actually used usenet for discussion, there was a newsgroup called alt.possessive.its.has.no.apostrophe. Ah the olde internet.

  • @[email protected]
    cake
    link
    fedilink
    English
    110 months ago

    I still use Perl for most things – it’s my go-to language when I have to get something done quickly. And quickly doesn’t have to mean small one-liner scripts.

    My biggest reason for using it is that mod_perl is still blazingly fast.