4 ms·
I used to kind of unfairly disparage perl, but now I regret never learning it. I've written a lot of scripts for munging text/files that outgrow bash, and when
by ForkMeOnTinder 3y ago
I used to kind of unfairly disparage perl, but now I regret never learning it. I've written a lot of scripts for munging text/files that outgrow bash, and when I rewrite in Python they get twice as long. Seems like perl would be a happy medium and let me keep using a lot of the nice bash shortcuts like `baskticks` for shell execution, etc
- jph00 3y agoYeah so many people shooting themselves in the foot by failing to take advantage of this powerful tool - as you say especially for stuff that you might have otherwise used an overly-complex bash script for.
- nerdponx 3y agoI find Python much easier to read and write, whereas I find it hard to write Perl as anything but an unstructured blob. Its main advantage for me is that interpreter startup time is significantly faster than Python, Ruby, Node, and most Scheme implementations. So it's useful if I ever need to call an external program for some text processing inside a shell script. Otherwise I strongly prefer the maintainability of Python.
- quickthrower2 3y agoNow with LLMs to reduce feature discovery pain there is less of an excuse! Edit: this applies to any language not just Perl. I use it to learn Python things I would otherwise miss.
- SoftTalker 3y agoI once went looking for something like Ansible that was implemented in Perl. Does such a thing exist? I think declarative system orchestration got popular well after perl's popularity declined. In any case, I did not find anything.
- shrubble 3y agoThere is CFengine which can have modules for it written in Perl, but itself is not written in Perl.
- singingfish 3y agoRex: https://metacpan.org/pod/Rex https://metacpan.org/pod/Rex never used it but
- SoftTalker 3y agoThanks!
- amstan 3y agoTry xonsh. It's an unholy merging of python in a shelllike syntax. It can work as your system shell and/or you can write scripts in the superset of python.
- eigenlicht 3y agoI've forgotten almost everything about Perl, but one thing I dimly remember is that for just about anything exceeding your one-liner/dirty one-off script (outgrow bash??) you'd use some library anyway, even for purposes like this. Just to make it sane. In other words it came down to more or less what you do in Python post Y2K: run(['blah'], ...) Not necessarily shorter (how?), probably not better (how?), certainly not safer (nope!) and "even" to reproduce everything subprocess can do these days I think you'd rather needed 3 or 4 imports, minimum, and remember this is Perl. So we're not talking standard library. Off to CPAN you were. Not all was great, even in heyday, and eventually people jumped ship for reasons, different reasons. Still, Perl deserved better than a bizarre zombie afterlife or undead pseudo-existence hinging on hardly more than worn out UNIX yarn. Funny how no one ever recalls tcl? Such is true rest. Such is nirvana. Yet tcl got that actual object system that never arrived for Perl. Tcl could do threads when Perl hardly knew there's such a thing! Oh and yes, tcl shipped its own GUI on top, consider that, vanilla Python even comes with it today I think. That's a way to go.
- WesolyKubeczek 3y agoIt’s interesting that while macOS is weeding out scripting language runtimes as the internal tools get rewritten (in Swift, I presume), one that is likely to prevail is Perl, so deeply is it entrenched there. Curiously enough, Ventura ships with not one but two perls, 5.18 and 5.30. I haven’t yet investigated which tools there are using Perl. (It could also be that some prominent third party applications still call out to Perl, expect it to be there, and vendors asked nicely. How else would you explain the 5.18?) It seems to be an apt illustration of the Lindy effect more than anything.
- heresie-dabord 3y ago> I used to kind of unfairly disparage perl It was fashionable in programming discourse for people to parade their skillful opinions about things they never really understood. And it still is. ^_^ Even today in 2023, some people continue to disparage bash, awk, sed, grep, and Perl as though these tools form a common nightmare for all humanity. But these are very successful tools that solve problems quickly, efficiently in memory, and across many hardware platforms. People are free to dislike the notation and to prefer Python or Haskell or Powershell. But some detractors simply behave in a bigoted way towards languages that they have little desire to learn. And as far as their objections to the notation are concerned, the same expressive problems find similar notational solutions in Powershell and the various DSLs that Python includes (e.g. numpy, pandas). Bash, awk, sed, grep, and Perl are robust, durable, portable tools. Their developers were/are smart people. I've found that knowing these tools well has been important in my career. And I also code in Python.