6 ms·
I love Perl. I use almost none of its more esoteric features, and just write "classic procedural" code, mostly using command-line utilities instead of third-par
by forgotmypw17 4y ago
I love Perl. I use almost none of its more esoteric features, and just write "classic procedural" code, mostly using command-line utilities instead of third-party modules for anything I don't want to write myself (mainly cryptography), and I am so fucking happy not having to deal with breaking changes in my language, a rare quality these days.
I used a machine with a 9-year-old distro on it for a few months, and all my scripts ran without issue, and I have high confidence that they will continue to run for years down the road without my having to adjust them for breaking changes in the language runtime, which is more than I can say for most other stacks I've used.
Furthermore, ALL the code examples I can google up will work without me having to check if they're for the right version of Perl, because it has near-perfect backwards compatibility going back all the way to 5.000 from 1994.
About the only other thing with a comparable level of stability has been HTML/JS/CSS, which gets a lot of new features all the time, but, for the most part, if I use only minimal features, remains usable for years without modification.
- taeric 4y agoTeX has stability to compare. But, stability is seen as a goal for that project.
- giraffe_lady 4y agoI don't know if its backwards compatibility reaches into the 90s but I've been using ruby for this for like a decade now. Most envs that ship with anything ship with ruby and I've only very rarely run into version problems. I think people tend to associate it only with a certain era of web dev, but it has remained a good scripting language with a large, consistent, well-documented standard library for a long time now. Not worth switching off perl since you're very used to that, but iirc ruby was initially conceived as a successor to perl and for me at least it has landed in that role.
- forgotmypw17 4y agoRuby is great, and I know people who swear by it, but I've yet to come across a GNU/Linux distro which didn't come with Perl installed, while Ruby is not a given in the default, e.g. my current Manjaro. The compatibility really does stretch back all the way to '94.
- pseudostem 4y agoOn OpenBSD, some of the scripts or utils (mandoc) are written in Perl because the developers prefer it. There have been some email chains on the mailing lists about having Perl in base. Most of them are interesting to read.
- anthk 4y agoThe pkg_* suite it's written in Perl.
- jrumbut 4y agoRuby is a fantastic scripting language and I generally use it instead of Perl but for the ugliest corner cases, character encoding gotchas, *nix system oddities, etc I frequently find someone from the Perl community has had my problem and solved it with a regex. I think it's the sysadmin culture. If your scripts are used by thousands of different servers hosting custom web apps and strange databases you'll run into every possible bug fast.
- richard_todd 4y agoYeah, I agree with you. For fun I built Perl 1 a couple years ago and was amazed at how similar it was to Perl 5. In fact most of the test suite from Perl 1 runs unmodified on Perl 5. The subroutine calling syntax was different (it used `do xxx();` I think) so those tests fail. But unfortunately, some Perl devs in recent years keep thinking that what they need to do is break stuff to "modernize". They keep eyeing goals like turning `strict` on by default, and eliminating lesser-used features, which will surely break untold numbers of 20-year-old scripts. I think there is some low-level anxiety among some of their developers that interest in their language has basically evaporated and they keep reaching for a silver bullet that doesn't exist. I think they are crazy ("perl 7... now 10% more like python!") but it's open-source so in the worst case I'm sure someone will keep a traditional perl from bit-rotting. edit: I had made a short blog post about playing with perl 1: https://rwtodd.org/2020/Jun/building-perl-1 https://rwtodd.org/2020/Jun/building-perl-1
- mfontani 4y ago> They keep eyeing goals like turning `strict` on by default Not unless you declare a version. Old style perl will continue to work as before. If you declare something like: use v5.40; ... then, and only then, you'll get strict/warnings/whatever turned on. Your 20 year old script can continue to run just fine.
- richard_todd 4y agoThat doesn't really capture what's been happening. If feature bundles are still today's plan, it's only because the multiple attempts to get strict on by default have so far all been defeated. They are still pushing forward adding options to disable features like indirect calls, multidimensional hashes, bareword filehandles, etc. And you can bet that at some point they will revive the idea of moving to Perl7/8/9 and permanently remove those things as they go. Some--not all--of the people working on perl really want so-called "cruft" to disappear. I'm not a fan of that attitude for such an old language with such a rich history of backwards-compatibility, and I definitely don't think it's going to accomplish some kind of perl renaissance. I think it would be better to double down on what makes perl unique. When I watch Signes giving a talk like https://www.youtube.com/watch?v=FlGpiS39NMY https://www.youtube.com/watch?v=FlGpiS39NMY where he shakes his head at variables like `$;` or `$,` (29:20 in the video) ... it looks like the leaders of perl hate how strange it is. That worries people like me, who love perl _because_ of its quirkiness, not in spite of it. Surely people who want something more consistent have moved to Ruby long ago.
- scruple 4y agoI only touched Perl a little bit, at the start of my career in the mid-to-late 00s. I didn't hate it. For our specific use case, which was generating reports from large groups of text-based log files, it was wonderful. I'm curious, though, do you have any Perl programs you've worked on recently that are public? I'd love to take a look at how people are writing Perl these days...
- forgotmypw17 4y agocheck my profile :) template default perl
- stefantalpalaru 4y ago
- SOLAR_FIELDS 4y agoCurious - is there a reason to use Perl (Wall's latest version, 5 or whatever) in 2022 if one has no familiarity with the language? What would be the major advantage of using Perl over its closest analogues, some bastardization of Bash and Python?
- thesuperbigfrog 4y ago>> Curious - is there a reason to use Perl (Wall's latest version, 5 or whatever) in 2022 if one has no familiarity with the language? What would be the major advantage of using Perl over its closest analogues, some bastardization of Bash and Python? It depends on what you are trying to do. Perl excels at processing text particularly if you are familiar with regular expressions. Perl mainstreamed regular expressions and most programming languages that support regular expressions support some subset of Perl regular expressions. Perl is faster than both Bash and Python and scales up a bit better than Python as a project starts to grow because 'use strict' and 'use warnings' will catch many errors. Python has a better 'batteries included' standard library, so it tends to be better at prototyping than Perl unless you are pulling in libraries in which case it depends on what you are trying to do. Perl can be more terse than Python, particularly if you are using built-in variables. However, this impacts legibility which is part of the reason why Perl is the target of 'executable line noise' jokes.
- doomvox 4y agoWell, Larry Wall's latest project was called "Perl 6" but has been renamed "Raku"-- in belated recognition that it really is a new language, and Perl is going to continue being Perl. The main reason to learn Raku at present is simply that it's profoundly different from most other things out there-- there's no particular "killer app" that's emerged for it, but it's unusual enough that this might happen yet (no one expected Perl would be critical for "Web 1.0" and the Human Genome Project...). Some Raku features: (1) it's numeric types include true rational numbers, so there's less chance of being tripped up by floating point approximations (e.g. 2/3 is really 2/3, and if you multiply by 3 later you get precisely 2). It also does big integers by default: you're less likely to have overflow problems. (2) Raku's regular expressions have been redesigned from scratch, and it ships with expanded capabilities to compose them into larger structures called "grammars": Raku is a uniquely powerful tool for writing special-purpose parsers, ala domain-specific languages. (Note: this is how Raku parses itself-- it's not implemented in the usual lex and yacc style.) (3) Extremly convenient features for handling CAP (concurrency, asynchrony, parallelism), possibly the easiest to use of any language. As for Perl (meaning the original, Perl 5), it's vastly superior to traditional bash scripting because all the components were brought into one process where they could be made more consistent and talk to each other easily. How Perl compares to Python is a little difficult for me to answer: I prefer Perl, but I could be biased on this one, and there's no question Python has quite a bit of momentum at present in a number of areas.
- petdance 4y ago> I use almost none of its more esoteric features Which features do you see as esoteric?
- forgotmypw17 4y agoTo me, it means features which would not be obvious to me in their function coming from a PHP/C/VB/Java background. I typically write code which I can (and do) copy and paste into PHP almost without changes. (I use PHP as both webserver glue and for duplicating functionality so that I can have two copies of the same code to validate against each other.) I've also started adding some Python to my project and developed a very similar style in Python, using commented curly braces to reduce the code's brittleness.