News for hackers. Stuff that matters.
Re:Perl Turns 34 Today by cglong on Saturday December 18, 2021 @04:48AM (#29603238)
Do you have any good examples of how to get started with Perl?
Re:Perl Turns 34 Today by eCa on Saturday December 18, 2021 @05:14AM (#29603352)
Slightly related to your question, if you do get started with Perl you might find Task::Kensho[1] useful. It is a curated list of recommended CPAN[2][3] distributions for various tasks. CPAN is vast, so it is useful also as an introduction to CPAN itself.

[1] https://metacpan.org/pod/Task::Kensho

[2] https://metacpan.org/

[3] https://en.wikipedia.org/wiki/CPAN

Re:Perl Turns 34 Today by walterbell on Saturday December 18, 2021 @07:08AM (#29603882)
Is there a good chance of those distributions supporting Perl 7?
Re:Perl Turns 34 Today by eCa on Saturday December 18, 2021 @08:23AM (#29604309)
I would presume that most (if not all) code that runs on Perl5 v32 will also work on Perl7. (Based on what I know about the plans for Perl7.)
Re:Perl Turns 34 Today by kbenson on Saturday December 18, 2021 @05:15PM (#29609100)
I wish I could be confident that Perl 7 was actually going to see the light of day. Honestly, I was extremely excited when they announced it, and hoped it could make a real difference. The lack of real status information since then (even past the proposed initial release date) along with the implosion of the a lot of the core community and steering, is honestly what finally broke me from thinking anything could be salvaged for the future.

If Perl 7 is actually still coming and there's real progress there, then there's a spectacular messaging fail going on.

Perl's been my go-to language for well over 20 years, and it's the first thing I reach for when writing anything new. The problem is I'm having a harder and harder time justifying that decision. I built something small with Deno for the first time a few months back because I both wanted to try out typescript and I wanted something that I could easily turn into an executable on windows. The built in features (compile to an executable, limited security exposure based on runtime flags) and the ability to go far past JS because it as TypeScript built in all put a lot of stuff with Perl in stark relief. These are features you get when you have people actively trying to solve people's problems, iterating on substantial new and better things, and you have users (or potential users) with problems to solve. Perl 7 is/was possibly Perl's last chance to pull itself out of the ashes and try to offer something new to pull new people in and bring old users back, and I'm just not sure there's enough of a community left to pull it off. That's extremely sad, but ignoring it won't make it any less true as I see it. Hopefully I'm wrong.

Re:Perl Turns 34 Today by Grinnz on Saturday December 18, 2021 @05:37PM (#29609284)
The original proposal for Perl 7 was good at grabbing attention, but not good at being something that could reasonably be accomplished by the current set of core developers - it would require either maintenance of two forks of the language (not feasible), or sunsetting of Perl 5 (risking it all on unlikely adoption and migration to the new fork, and likely losing several volunteer developers).

The current status is, roughly, planning for Perl 7 to be a compatible release with good features, and waiting until such a featureset is ready. See https://perl7faq.grinnz.com

Re:Perl Turns 34 Today by kbenson on Saturday December 18, 2021 @07:26PM (#29610173)
The way I read it (which might have been reading between the lines), is that whatever 5.3x was released with Perl 7 would be the last in that line, but it would never die, and just get bug fixes.

I viewed Perl 7 as a way to break from the expectations of the two types of existing Perl users. Those that use it for stuff they expect to continue working without fail in perpetuity, relying on Perl's exceptional forwards compatibility, and those that are willing to break that to usher in new features that are long overdue.

At work we have Perl in production that's well over two decades old, and all stages in-between because it's always been the core language of our department. The expectation that it "just works" for the most part on newer OS distro releases with newer Perl is extremely valuable to us. At the same time, new development in it has gotten more and more cumbersome over the years, both in relation to other options and in itself, as modules for newer services and APIs are less likely to be available and well maintained.

Perl 7 as an idea was exciting to me because I viewed it as a way to both satisfy the needs of the job I'm in (through a static Perl 5 version), and also my personal tastes by allowing Perl to evolve and change as needed, and add some long overdue features (or even just change defaults to be sane for the current time).

Re:Perl Turns 34 Today by Grinnz on Saturday December 18, 2021 @07:36PM (#29610229)
You were reading between the lines, and the initial announcement was writing between them. But like I said, it is not feasible to maintain a LTS Perl 5 next to a fork of the interpreter. The actual proposal was only even to maintain Perl 5 for a few years before sunsetting it. CPAN would not have been compatible with Perl 7, it would require a separate ecosystem of code and installed libraries. The ideas sound nice but I don't think a lot of people would have been happy with how the details would have worked out. Most of the problems you're talking about are more a deficiency of perception and tooling, and these can be addressed without such drastic measures.
Re:Perl Turns 34 Today by kbenson on Saturday December 18, 2021 @07:44PM (#29610263)
> But like I said, it is not feasible to maintain a LTS Perl 5 next to a fork of the interpreter.

I know, but even if the Perl community didn't want to maintain it, it would be maintained. Some company would take that up and provide it (ActiveState maybe?), because there's a need for it and companies that would pay for it. That it would be maintained is all that really mattered to me, and there's no doubt in my mind that it would be.

> Most of the problems you're talking about are more a deficiency of perception and tooling, and these can be addressed without such drastic measures.

I'm not sure they can be. There's a decade of the past of evidence that they wouldn't be, even if it is theoretically possible. As soon as you make breaking changes, you would possibly lose a lot of corporate users because you force work on them where there wasn't previously, and that means deciding whether that time is better spent moving away from the aging language with an unsure future. Losing those users would gut what little was left of the community.

That's long been the catch-22 of Perl, and getting past that has long been the hardest problem facing the community, IMO.

Re:Perl Turns 34 Today by Grinnz on Saturday December 18, 2021 @07:55PM (#29610327)
> That it would be maintained is all that really mattered to me, and there's no doubt in my mind that it would be.

Nor mine, but because I know that Perl 7 would die as most of the maintainers stayed working on Perl 5. Or the worst case: too many leave Perl entirely to maintain either fork. Perhaps some corporations would take up the funding, but it is not a simple piece of software you can throw new developers at and expect progress; it's an enormous C program built on thousands of macros and decades of history, as anyone who has tried writing XS code probably sees in their nightmares.

> As soon as you make breaking changes,

I am referring specifically to doing it without breaking changes, as is the current plan, and the only option at this juncture.

Re:Perl Turns 34 Today by citrin_ru on Saturday December 18, 2021 @08:35AM (#29604370)
http://modernperlbooks.com/ is a good introduction to the language
Re:Perl Turns 34 Today by Farow on Saturday December 18, 2021 @05:18AM (#29603365)
You can start from the official tutorial: https://perldoc.perl.org/perlintro
Re:Perl Turns 34 Today by hkt on Saturday December 18, 2021 @05:21AM (#29603383)
Is the camel book (o'reilly) still relevant? I found it really helpful back in the day.
Re:Perl Turns 34 Today by asicsp on Saturday December 18, 2021 @05:27AM (#29603410)
Re:Perl Turns 34 Today by roywashere on Saturday December 18, 2021 @05:50AM (#29603505)
Re:Perl Turns 34 Today by markoman on Saturday December 18, 2021 @06:54AM (#29603812)
Yes, this is "the Llama book" -- Learning Perl. Next to read would probably be Intermediate Perl, and then probably "the Camel book", which is Programming Perl.
Re:Perl Turns 34 Today by pkrumins on Saturday December 18, 2021 @07:14AM (#29603908)
World's #1 Perl advocate and fan checking in.

Start with the greatest books every written:

Programming Perl - https://www.oreilly.com/library/view/programming-perl-4th/97...

Continue with the second greatest book ever written:

Intermediate Perl - https://www.oreilly.com/library/view/intermediate-perl/05961...

Followed by equally amazing book by the greatest programmer in the world:

Higher Order Perl - https://hop.perl.plover.com/

And of course:

Mastering Perl - https://www.oreilly.com/library/view/mastering-perl/97805965...

To get super quick in the command line, also you might want to get my book:

Perl One-Liners Explained - https://nostarch.com/perloneliners

Finally, join #perl on Libera Chat.

AS A NEW USER WE LOVE YOU WITH GREAT HUGE LOVE.

(Also screw all Python programmers, what a bunch of losers with their indenting rules and PEPs. Weirdos. Whenever you hear somone say Python is good or interesting, run.)

Re:Perl Turns 34 Today by heresie-dabord on Saturday December 18, 2021 @09:57AM (#29604898)
You had my agreement until

> (Also screw all Python programmers, what a bunch of losers with their indenting rules and PEPs. Weirdos. Whenever you hear somone say Python is good or interesting, run.)

Even as a jest, it's a poor representation for the Perl language.

Python has problems but has enjoyed success for a few reasons.[1] I think one of the worst side-effects of Python is that Python programmers tend to look at any powerful language with disdain if it has any non [a-zA-Z] characters. "Can't we just replace everything with Python?!"

Becoming a language bigot -- or joking like one -- does not help.

Perl can stand very tall on its expressiveness, stability, speed and simplicity.

[1] I'm going to say...

a) Python is more readable, but makes the crazy compromise of using whitespace as logic.

b) Python has adequate threading for many use-cases.

c) Python's built-in OOP has better affordance than Perl5 OOP. BUT... Perl enables building anything you want. If you want a dictionary with only two methods, you can build it. And Perl5 will have a more modern OOP implementation.

Re:Perl Turns 34 Today by bmn__ on Saturday December 18, 2021 @11:12AM (#29605572)
> it's a poor representation for the Perl language.

The Python people started this fight in 2000 and have since said much worse and heaps more, most of it untrue and libellous; turn-around is only fair. Those who live in glass houses shouldn't throw stones.

Re:Perl Turns 34 Today by phlakaton on Saturday December 18, 2021 @11:30AM (#29605772)
There is no more a well-defined “Python people” than there is a “Perl people” – both of their user bases span industries and computing architectures, hobbyists and professionals, old bones and young bloods, true believers and weary journeymen – and they overlap significantly, for that matter. Talk about cutting off your nose to spite your face.
Re:Perl Turns 34 Today by Grinnz on Saturday December 18, 2021 @12:10PM (#29606201)
Sinking to their level doesn't move anyone forward.
Re:Perl Turns 34 Today by bloopernova on Saturday December 18, 2021 @07:35AM (#29604020)
I unabashedly love this comment.

As a somewhat "new" sysadmin/coder back in the early 2000s, those blue O'Reilly books were like a business card, comfort blanket, and encyclopedia all in one.

I'd add "Mastering Regular Expressions" and maybe "Perl Best Practices". Oh and definitely "The Perl Cookbook", because it mirrored the way I learn best; from needing to do "a thing" and finding an example that mostly fits what I need.

Re:Perl Turns 34 Today by dsr_ on Saturday December 18, 2021 @08:19AM (#29604282)
I have often wished for "The $language Cookbook" for many values of $language. Highly recommended.

I think "Mastering Regular Expressions" can be almost completely replaced by 'man perlre', but perhaps not for utter neophytes.

Re:Perl Turns 34 Today by bloopernova on Saturday December 18, 2021 @10:15AM (#29605034)
My only issue with man pages is that I can't flick through them away from my desk or computer/device.

Which makes me wonder how easy it is to make a pipeline for man pages to my Kindle device/app. Hmm. Another rabbit hole to follow, joy!

Re:Perl Turns 34 Today by sirsinsalot on Saturday December 18, 2021 @08:23AM (#29604303)
Ive read your other comments in this thread and was amazed to see you referring to yourself as an advocate.

I think you do the language a disservice and associate Perl with childish views on other languages.

May explain why Perl is struggling.

I really hoped unintelligent bashing of languages died out after those of us who were 12 in the 90s grew up and realised peoples tooling isn't a personal statement.

Re:Perl Turns 34 Today by ydant on Saturday December 18, 2021 @08:13AM (#29604236)
Looking back on it, I probably have those blue O'Reilly books ( and Perl Cookbook https://www.oreilly.com/library/view/perl-cookbook/156592243... ) to thank for starting me off on my programming career and influencing so much about how I grew as a programmer. Very informative books and fun to read. What a great set of authors.

I now program almost exclusively in Python (it's good and interesting) and Java. But occasionally I fall back to Perl for something that is just so much simpler - almost muscle memory.

Re:Perl Turns 34 Today by Siira on Saturday December 18, 2021 @08:09AM (#29604216)
I started with the one-liners book, and I recommend others do the same. It’s quick and useful for pretty much anyone who isn’t an AWK master. Then go learn more advanced stuff.
Re:Perl Turns 34 Today by pkrumins on Saturday December 18, 2021 @08:11AM (#29604226)
Thank you very much!
Re:Perl Turns 34 Today by zerocount on Saturday December 18, 2021 @09:07AM (#29604565)
Yep, Python's the new Visual Basic. Also the Rust people might be a little weird too since Rust likes to kick you in the nuts with its type system.
Re:Perl Turns 34 Today by HeckFeck on Saturday December 18, 2021 @07:39AM (#29604044)
> Also screw all Python programmers, what a bunch of losers with their indenting rules and PEPs. Weirdos. Whenever you hear somone say Python is good or interesting, run.

Amen. This is my credo.

I had to program Python in my last job and I ran as fast as I could from that world of artificial limitation, and landed squarely in the land of camels and onions: The Promised Land.

Re:Perl Turns 34 Today by 7thaccount on Saturday December 18, 2021 @04:48PM (#29608858)
I've written a bit of Perl and have read quite a few Perl books (I legit probably own 10+), but generally prefer Python. I can't understand how someone open minded enough to be cool with Perl and it's strangeness, would be upset by something as trivial as whitespace. It obviously isn't that much of a problem as it's one of the most popular languages ever and used in so many domains with users ranging from children to Google's chief scientist and with it being a critical backbone of many companies and the defacto language to build an API for. It's fine to find it aesthetically displeasing if that is what you want.
Re:Perl Turns 34 Today by heresie-dabord on Monday December 20, 2021 @10:45AM (#29626153)
If I may engage you in discussion, friend...

> I can't understand how someone open minded enough to be cool with Perl and it's [sic] strangeness, would be upset by something as trivial as whitespace.

Thank you for the compliment of open-mindedness. Every language is strange to some degree until one becomes proficient. Notice your own grammatical error above. English too is strange until one masters it. But we won't blame people for making mistakes because bad code can be written in any language.

Whitespace is not trivial in Python. It has been promoted to logical operator.

Now everything that I type gets broken unless I use an editor to protect me. Oh, you might say, any modern editor should be capable! This leads to IDE dependence like Eclipse and PyCharm (both written in... Java).

There is none of this nonsense with Perl. I work on systems of every size with the simplest, most robust set of tools. I don't need a complex baseline just to write my code.

> It obviously isn't that much of a problem as it's one of the most popular languages ever and used [...] from children to Google's chief scientist [..] critical backbone of many companies [..] defacto language to build an API for.

C, C++, Java, Javascript and Bash are also very popular languages. The first three are more important that Python. And they are all unlike Python. Google has formally sponsored Python for some time, which certainly helps Python. Google has also been developing Go, which is itself a better language than Python in many ways. And Go solves the problem of formatting for readability in a sane way (go fmt).

An API can be expressed in many ways.

> It's fine to find it aesthetically displeasing

The above criticisms are objective.

However, I don't like how many lines idiomatic Python requires because of the whitespace promotion. At its best, Python allows clear, compact expressions such as lambdas.

At worst, Python is needlessly puffed with emptiness. Perl is as compact as the coder wishes it to be. It is easy to run perltidy and colourise the output for a formatted view if one prefers.

Re:Perl Turns 34 Today by 7thaccount on Monday December 20, 2021 @08:16PM (#29632660)
With perl you have to add all sorts of junk like "use strict;" and "use warnings;". There is no REPL to incrementally test small snippets. You have to remember all kinds of things such as context for sigils. I still don't have a problem with the language, it's just different.

I don't think anyone would compare Python to C or Java. C is good for microcontrollers and drivers (that sort of thing), while Java is good for large enterprise systems. Python on the other hand is an excellent scripting language. Much more popular than perl by the numbers where nearly all scripting, data science (well, R too), and ML is used. Every application I've seen in the last decade has had a Python API, but none use a Perl. I've literally never heard of a Python developer switching to Perl, but I've lost count of the number of folks switching to Python from Perl over the years (HN threads). Simply speaking, the numbers show that the faults of Python (there are many) are still less than those of Perl (also many). As far as whitespace goes, it means it's easy for all Python coders to read each other's code once you adjust for a spacing difference. No need to run something like "perltidy". I've never once needed a fancy editor like eclipse. I've used the little Tk editor IDLE, Spyder, just notepad ++, and Vim + Command Line just fine over the past decade, just like how I've used Perl.

All in all, they're both great languages with several warts. Google isn't replacing Python with Go. Their uses are very different. Obviously Go makes for a more performant backend, but requires significantly more code, so there is a trade off. I would bet that Python and Perl have a pretty similar amount of semantic density (or whatever it is called). Saying it is puffy nothingness makes little sense. Just something like iterating through a file is pretty much the same in both languages. The use of lambdas was discouraged by Python's creator as it means more stuff for developers to learn and keep in their head. Larry Wall's TIMTOWDI means that the developer gets more power, but there are 10 different ways to do something and a lot of folks REALLY don't like that as it makes maintenance and learning more challenging.

Re:Perl Turns 34 Today by heresie-dabord on Tuesday December 21, 2021 @11:02AM (#29638646)
Thanks for your reply. I think your tone was fine. But you went a little astray. We were just talking about whitespace being promoted to logical operator, which was your interesting psychological point. Now you have unpacked your full set of criticisms. (o:

A couple of things attract additional comment from me:

> With perl you have to add all sorts of junk like "use strict;" and "use warnings;"

You named two things, and you call them junk. Maybe you don't recognise that these statements do toggle functionality in a useful way. Perl can be used effectively as a piped-command language. Perl's notation makes it terse and powerful.

> I don't think anyone would compare Python to C or Java.

But you made an argument from popularity. If popularity is to be taken as a rational, enlightened movement, other very important languages have converged on different notation from Python. (If we are still talking about notation and whitespace.) Python's notation is not the most popular, as much as its evangelists insist. Add Go lang to the bigger group as well.

I think Go will devour all the interpreted languages eventually.

> data science (well, R too)

Yes, in this field (data science may be a marketable construct), C++, SQL, R, Python, and Jupyter play the major role. Other languages may offer more in the future. Folks talk about Julia, for example. Perl's PDL has not been adopted as widely. Of course, once you have data, you can science it with any fast, robust tooling. I often use awk and Perl too.

Do you dislike awk and sed as well? I find that common among Python programmers.

> they're both great languages with several warts.

No language made by monkeys is going to be "perfect". Go fmt and perltidy make more sense than building an ecosystem for a personal preference. We both know that bad code can be written in any language.

I use both languages daily. Python has a better threading story despite the GIL. But I can find better tools that don't have Anaconda-size dependencies. (I cannot easily summarise my contempt for pip).

Re:Perl Turns 34 Today by lenkite on Friday December 24, 2021 @06:36AM (#29672761)
"I think Go will devour all the interpreted languages eventually"

This discussion was amusing to read, but I have to butt in days late. Go will not devour any interpreted language without an available interpreter of its own.

Re:Perl Turns 34 Today by 7thaccount on Tuesday December 21, 2021 @05:37AM (#29635999)
Edit: adding here since I can't edit the original article.

I hope the tone didn't come off as condescending or too argumentative. I was just doing my best to essentially say that all software stinks in it's own way (including both Python & Perl). The few times I've reached for Perl over the years, it has worked fine. Some of the issues such as having a fairly primitive OO system out of the box without reaching for Moo or Moose on CPAN are more than addressed with the very advanced Raku (formerly Perl6), but at this point, that's a perl inspired sister language and not a viable upgrade path.

Re:Perl Turns 34 Today by heresie-dabord on Tuesday December 21, 2021 @02:13PM (#29640900)
> a fairly primitive OO system out of the box

I will argue that it isn't primitive, but that it is composable and as lean as you want it to be. If I want a dict with just two methods, I can build it easily and with small memory usage. (This is important when scaling objects into the hundreds of thousands... or more!)

TBH, Perl5 OO is easy and tractable. I would agree that the "bless" artefact is unusual, but it does make sense from the point of view of C structs.

Oh, as far as REPLs go, there are some easy solutions for Perl, from trivial to more complex. Python's REPL is limited because it doesn't handle multi-line structures well. That is in part a consequence of using whitespace as a logical operator.

Re:Perl Turns 34 Today by pkrumins on Saturday December 18, 2021 @07:45AM (#29604078)
We should team up!
Re:Perl Turns 34 Today by HeckFeck on Saturday December 18, 2021 @08:47AM (#29604442)
Certainly, brother. Together we shall bring the Word of Wall to all.

I see a world where /usr/bin/perl will become PID1 and at every system boot will

    mv /usr/bin/python /dev/null
there shall the snake finally be consigned eternally.
Re:Perl Turns 34 Today by zerocount on Saturday December 18, 2021 @09:12AM (#29604592)
While you're at it, get rid of all the Rust, C++, and TypeScript as well. Let the world C the light.
Re:Perl Turns 34 Today by ruslan on Saturday December 18, 2021 @04:52PM (#29608909)
C++ as of '98 is ok. The rest is garbage.
Re:Perl Turns 34 Today by ruslan on Saturday December 18, 2021 @04:43PM (#29608822)
Also screw all Python programmers, what a bunch of losers with their indenting rules and PEPs. Weirdos. Whenever you hear somone say Python is good or interesting, run.)

I applaud this, standing.

Re:Perl Turns 34 Today by Grinnz on Saturday December 18, 2021 @12:00PM (#29606097)
For the record, shitting on other languages does not represent the values of Libera #perl. Though I personally would not use python or PHP, use whatever gets the job done.