Settings

Theme

Ask HN: Is Perl 5 or Perl 6 still worth learning in 2019?

15 points by grepgeek 6 years ago · 16 comments


SwellJoe 6 years ago

Perl knowledge has been extremely valuable for me, but I first learned it when it was still the scripting language of choice for just about everything (web, CLI, one-liners, etc.). Even Perl 5 is multi-paradigm and that's been helpful for me when I find myself parachuting into a new codebase in some language I don't know well. It's been easy for me to pick up Ruby, Python, JavaScript, Tcl, and even Rust, because of my Perl knowledge. I don't know if many other languages are quite as effective at teaching that kind of cross-paradigmatic approach, and Perl 6 should be even more effective, since it integrates even more paradigms.

I still prefer Perl 5 for most CLI scripting tasks, but use Python for a lot of stuff lately because I work with others who know Python and don't know Perl. Perl has better docs than Python (the Python standard docs are almost entirely free of usage examples which is just plain terrible). Perl has better out of the box support for writing good CLI tools. e.g. color and better options parsing are in the standard modules, which require additional modules in Python. I also think Perl has better testing tools included, though this one may be a matter of taste. Perl used to have a better/friendlier community than almost any other language, but that's no longer really the case...it's a lot of old-timers who can be extremely impatient with new learners (there's been discussion of this problem and there is a desire to do better, but it's still a thing).

The biggest OSS project I work on is almost entirely in Perl 5, so I still have reasons to keep using Perl, but I also tinker with Perl 6 now and then for fun...it's a cool language that I always seem to learn something new from. I might even take a stab at re-writing portions of our Perl 5 code in Perl 6 at some point.

johntdaly 6 years ago

I would say it’s only worth learning Perl 5 if you work in a shop that has a lot of old Perl code, otherwise Python is probably the most sensible option to learn (as much as it pains me to say) if you haven’t got a job yet. It will also help you with tools like ansible. Go might also have a future where Perl once thrived since you can compile your dependencies into the program. Dependencies sort of sucks with all scripting languages.

robertlemmen 6 years ago

IMHO there are two different things at work here: one is the tool or language that you are using for your job. This is highly specific, and most people will not be working with Perl 5 or 6 in their day job.

However, we all need to learn general software engineering much more as well, and that is a very different piece of problem: here the tools are not specific, you can do that in any language.

More importantly, no single language will allow you to truly understand software engineering, you must look at it from different vantage points, i.e. very different languages and development philosophies. In this area Perl, especially 6, is super interesting because it allows you to study a variety of interesting concepts while still being modern and accessible (compared to the alternatives of learning LISP, Prolog and who knows what). So: studying Perl will help make you a better software engineer, you can then apply that in whatever other language is required on that day for the current job.

That said, I think most systems I have worked on in C++ and Java could have been written in Perl 5 or 6 equally well. Some things would have been easier, some others harder...

  • raiph 6 years ago

    > More importantly, no single language will allow you to...

    That's one of the reasons why P6 is actually a braid of languages, plural, rather than a single language.[1]

    > most systems I have worked on ... Some things would have been easier, some others harder [using a different language]...

    That's another reason. The braid (which languages are mixed together), the braiding (how they're braided together), and the strands of the braid (individual languages) in the standard P6 distribution, are all mutable, evolvable, forkable, mergeable, via a principled, governable mechanism.[1]

    cf Racket, except that P6 adopts the position that s-expressions aren't a good default syntax for most of the core code; macros aren't a good default approach for building up the majority of higher level constructs; automata other than turing machines need to be taken into account; and it all needs to be suitably version based so that various versions of languages in the braid, and of modules written in those languages, can peacefully co-exist.

    [1] https://www.reddit.com/r/ProgrammingLanguages/comments/a4z68...

harmil 6 years ago

Perl 6 is a great language to learn if your goal is to become a more all-around versed programmer. It has constructs from every major family of programming languages and some features that I've never seen in any other language (NFG strings, operator overloading/declaration with precedence, whatever-code (Lisp has a similar construct), slangs, etc.)

But if you want to learn a programming language that you'll use in your day-to-day job, then unless your day-to-day job is fairly unusual, you won't be using Perl 6. It's fairly slow, very light on surrounding modules unless you want to call out to a Perl 5 compatibility layer and in many modern areas none of the Perl variants have a significant footprint (machine learning comes to mind).

Don't get me wrong. I love the language and program in it daily, but not for work. I write Perl 6 code because I enjoy thinking in highly abstract ways using whatever programming paradigm comes to hand. I write JavaScript, Python, Bash and rarely Java for work.

harmil 6 years ago

I gave a separate answer for Perl 6, but as for Perl 5: Yes, absolutely. I think everyone should know Perl 5 if you ever touch a Linux system. It's installed everywhere and gives you the largest power/keystroke for command-line utility. It's more effective to learn Perl than AWK and Perl has incredibly deep Unicode support and what I call 4th-generation regular expressions (pre-POSIX, POSIX, and then the explosion of early Perl/PCRE/Python-re being the first three and Perl 6's full parser engine being the 5th) which, together, make it like the mythical tool it's often labeled as: the Swiss Army chainsaw.

Don't make the mistake of trying to write anything over a few lines in it, though. You'll find yourself in a deep hole trying to use Moose and "experimental" features just to get back to parity with every other modern language, and you'll still have thin if any support for many modern tools (i.e. those that entirely post-date 2010).

snapdangle 6 years ago

Perl 6 is my go to scripting language. The concerns about code styles don't apply at that point because it's all me. And the multi paradigm nature of Perl 6 means I can solve any given algorithm using a style that fits how I'm feeling in that moment.

karmakaze 6 years ago

I usually consider languages when I'm also choosing what to use it for. E.g. framework/language, or use-case/language such as Go for a small/low-level service.

Other than that I'll look at curious languages/implementations that are not yet widely known/adopted (e.g. Pony, Crystal, CHICKEN Scheme) for its own sake but not for main usage.

I would be interested in Perl6 if I had a use case for it. I don't write shell scripts that need more than bash and in those cases Python works for me. Anyone know any good Perl6 frameworks/libs (maybe for cli or ncurses)?

reddit_clone 6 years ago

May not help your resume much.

But I would say go for it (Esp. Perl6) just for the fun of it. It is a very modern multi paradigm language which is still accessible to regular folks.

raiph 6 years ago

Of course. (For some people.)

Here are some videos to give a flavor of the last few years of Perl 6 as it graduated from alpha in 2014 to beta in 2015 to the first ready for production releases of the Rakudo compiler in 2016, to outsiders doing videos about it in 2019 (last video).

* 2014. "There's this question of belief". 30 seconds.

Charming point made by Perl creator Larry Wall (during a long talk).

https://www.youtube.com/watch?v=enlqVqit62Y&t=37m40s

* 2014. "My first P6 program". 3 minute "lightning talk" presentation to an audience of Perl folk.

P5er Stefan Seifert shows what they learned and pulled off less than 24 hours after first writing P6 code. (This start led to https://modules.perl6.org/search/?q=inline)

https://www.youtube.com/watch?v=m_Y-lvQP6jI

* 2015. "P5 Pigs". 6 minute "lightning talk" with audience participation at a Perl conference.

Stephen Scaffidi sings his heart out about tensions in the Perl community about Perl 5 "vs" Perl 6. (In reality it's not "vs". They're different languages in the same family, analogous to the way Clojure and Racket are both in the Lisp family.)

https://www.youtube.com/watch?v=e5_7v7q98-g&t=48m10s

* 2015. "Hacking on Rakudo Compiler". 10 minute live coding screencast.

Rob Hoelz looks into 3 bugs.

https://www.youtube.com/watch?v=adUdmol7cLU

* 2016. "Perl 6 for beginners". A conference keynote. An hour, or 15 minutes if you're in a hurry.

Damian Conway is brilliant and hilarious. If you've never seem him, you're in for a treat. I strongly recommend the full hour. You will not be disappointed.

The first link below is for the full hour, the second jumps to the closing 15 minute "crash course on quantum computing".

https://www.youtube.com/watch?v=Nq2HkAYbG5o&t=5m

https://www.youtube.com/watch?v=Nq2HkAYbG5o&t=46m

* 2017. "How to hack the MoarVM JIT compiler". 47 minutes.

Bart Wiegmans, author of http://brrt-to-the-future.blogspot.com/, introduces tools that enable others to make MoarVM go incrementally ever faster. Probably only of interest to the hardest core hackers.

https://www.youtube.com/watch?v=N5_drt7TEqE

* 2018. "8 ways to do concurrency and parallelism". Hour+ presentation to P6ers.

Like Damian (previous video) Jonathan is another P6er who is also a great presenter.

https://www.youtube.com/watch?v=l2fSbOPeSQs

* 2018. "Perl 6 grammars for simple compilers". 4 minutes 20 seconds live coding screencast.

Andrew Shitov creates a toy language, its formal grammar, a parser, and its interpreter/compiler, from scratch, in less than 5 minutes, with full commentary explaining what he's doing as he does it.

https://www.youtube.com/watch?v=rxaB6m_sQKk

* 2019. "Learn Perl 6 In One Video". 80 minute screencast.

An "outsider" covers P6 basics at speed.

https://www.youtube.com/watch?v=N5_drt7TEqE

vividsnow 6 years ago

try and decide

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection