20 ms·
Not Your Grandfather’s Perl
- mansilladev 4y agoAs if Perl already didn't have a bad reputation for readability, that black or dark gray text in that <code> blocks.. phew.
- mgraczyk 4y agoSpent about 4 weeks learning perl at an internship 10 years ago. I believe that is one of the biggest professional mistakes I ever made. There is literally nothing I would recommend doing with perl over python.
- xani_ 4y agoMost Python code from 10 years ago won't run on modern distro. Almost all Perl code will
- TristanBall 4y agoFour weeks learning a language was one of your biggest professional mistakes? Really? What were the repercussions of this terrible deed?
- mgraczyk 4y agoI wasted the entire internship writing horrible perl code and not learning how to do anything that I would use later. This was early enough in my career that it had a lasting effect on my perception of software development and it took me 3+ years to get back "on track".
- pmontra 4y agoThumb up for function signatures! I slowly switched from Perl to Ruby for writing my own text processing scripts. A loop with <> is very convenient but I was using Ruby for work (still do among other languages) and Perl for nothing. I was forgetting how to do stuff in Perl.
- csdvrx 4y agoEven on modern hardware with vectorization, the speed of perl is hard to match for stream processing. I write and deploy brand new perl code in 2022 to replace some clunky python and javascript - for real! AMA!
- clscott 4y ago1. What's your top technique for keeping it fast? 2. Are you hiring?
- csdvrx 4y ago> 1. What's your top technique for keeping it fast? Using the stock install as much as possible. Since a perl interpreter is available about everywhere, this makes the scripts cross platform very easily too. > 2. Are you hiring? Maybe? You have no email in your profile. Can you please send your CV to my nickname at outlook dot com?
- wistlo 4y agoI'm working in Windows (employer's choice) and need to process some huge data files on the desktop. Perl (Strawberry Perl for Windows) is much faster than native Powershell (or CMD) scripts. A few Perl one-liners and I have 2 GB processed in a couple of minutes. Big fan of Perl here.
- anthk 4y agoPerl is the Unix utilities' replacement for Windows. It can do awk/sed in one place. What I miss it's a "strings(1)" replacement for Perl.
- kal247 4y agoThere's a "strings" implementation in the PerlPowerTools : https://metacpan.org/pod/PerlPowerTools https://metacpan.org/pod/PerlPowerTools
- 4y ago
- forgotmypw17 4y agoWith function signatures and state variables added in 5.010, I consider Perl feature-complete and have not really missed anything from it for as long as I've been writing Perl. What I do appreciate that's missing from many other languages and systems is the extreme committment to backwards compatibility. The knowledge that the next minor release won't break existing scripts is underrated, IMO. Solo project with ~23K LOC of Perl and counting here. Bless you, Larry Wall and Perl maintainers. Keep it up!
- yamtaddle 4y ago> What I do appreciate that's missing from many other languages and systems is the extreme committment to backwards compatibility. The knowledge that the next minor release won't break existing scripts is underrated, IMO. I don't write much Perl these days and haven't for some time, but it's still what I might reach for if I were tasked with writing something suitable for a scripting language that had to run with ~0 operational or upgrade/maintenance budget for a decade or more in environments I wouldn't necessarily be able to control or influence, or else [bad thing will happen].
- latchkey 4y agoPerl needs backwards compatibility given the `write once, read never` nature of the syntax. Imagine trying to upgrade this to some new syntax... https://github.com/schwern/AAAAAAA https://github.com/schwern/AAAAAAA
- TimTheTinker 4y agoThat looks more like write-only naming... but the syntax itself isn't bad at all. Here's the main module: https://github.com/schwern/AAAAAAA/blob/aaaaaa/aaa/AAAAAAAAA.pm https://github.com/schwern/AAAAAAA/blob/aaaaaa/aaa/AAAAAAAAA...
- liveoneggs 4y agogross. Look at all of those non-'A's
- superkuh 4y agoI'd argue perl's major value is from stability in the sense that what the perl developers write today can be run on the perl available on any machine, new or old. If a lot of perl developers end up use'ing lots of these new features that feeling of compatiblity will go away.
- cestith 4y agoIf you need new code you write today to run on 20 year old systems, don't use the newer features. Perl 5.36 is backwards compatible to code written for Perl 5.6 after all. If you need 20 year old code to run on new machines, the same thing occurs - you hand it to a recent Perl 5 and it works. Compare and contrast the last 20 years of PHP or Python.
- csdvrx 4y ago> If you need 20 year old code to run on new machines, the same thing occurs - you hand it to a recent Perl 5 and it works. You're only noticing half of the picture. If you want to write code that'll still run in 20 years, do the same.
- cestith 4y agoAre you saying that in 20 years they'll have removed all the features added in the last 20 years?
- pkrumins 4y agoI love Perl!
- samiam_iam 4y ago
- samiam_iam 4y agoMy grandfather was too smart to use Perl.
- wistlo 4y ago"Bare bones" seems to be a good thing for Perl. I use Strawberry Perl on Windows and it is orders of magnitude faster than Powershell for processing large files of text strings using regular expressions. I hope the addition of a "new object-oriented programming framework" won't take away the "bare-bones" speed of the current release.
- anthk 4y agoPerl's bindings for Win32 and OLE are amazing.
- csdvrx 4y agoWould you have some interesting examples? I love Win32 because it's the closest we have to a universal GUI format for software.
- anthk 4y agohttps://metacpan.org/pod/Win32::OLE https://metacpan.org/pod/Win32::OLE https://metacpan.org/pod/Win32 https://metacpan.org/pod/Win32 https://metacpan.org/search?size=20&q=win32 https://metacpan.org/search?size=20&q=win32
- jug 4y agoReally? This is interesting! I had completely written off Perl for Windows due to its heritage. But we still use COM objects in our scripts here and while I like PowerShell conceptually, I really never got to have fun with it as a scripting language. It just has so many quirks like “implicit returns” etc. and is just so verbose it’s bordering on hard to read at times.
- anthk 4y agohttps://metacpan.org/pod/Win32::OLE https://metacpan.org/pod/Win32::OLE https://metacpan.org/pod/Win32 https://metacpan.org/pod/Win32 https://metacpan.org/search?size=20&q=win32 https://metacpan.org/search?size=20&q=win32
- cheaprentalyeti 4y agoDamn Pythonistas! Get off my lawn!
- cheaprentalyeti 4y ago(Shakes cane at clouds)
- 1024core 4y agoI am forced to use Python, and I hate it.
- HeckFeck 4y agothe camel shall crush the serpent
- JackFr 4y agoMaybe I’m missing the point of this piece, but it’s probably because I’m still reeling from the author’s idea that adding “say()” which is “print()” with a newline added, is somehow an improvement to the language.
- lloeki 4y agoThe point is not about `say` itself (which has been there since Perl 5.10, released on 2007/12/18), it's only an example of how much Perl uses modularity (via `use`) to enable new features while ensuring a) code dependent on a new feature alerts on Perl versions without the feature and b) backward compatibility of new Perl versions with old Perl code. Compare: # Perl use feature 'say' vs: # Python from __future__ import print_function Which at first blush follow the same principle, except that Python decides that `from __future__` is a vision into upcoming doom, that is a future version of Python for which code that preexists becomes incompatible unless it is ported to the new version. IOW py2 code doesn't run on py3, barking at you in obscure ways if you try, and py3 code doesn't run on py2, barking at you in obscure ways if you try. (or worse, partially runs and either explodes in mid flight or silently corrupts data). Whereas Perl code written targeting vX runs on Perl vY as long as Y >= X, and if Y < X then Perl tells you "unsupported feature foo" or "your perl is too old, update to at least X". $ perl5.18 sig.pl Feature "signatures" is not supported by Perl 5.18.4 at sig.pl line 1. BEGIN failed--compilation aborted at sig.pl line 1. (yes yes I am aware that with enough effort and trickery you could write code that works on both py2 and py3. I did that a long time ago; it's a pain, and doesn't solve the problem of preexisting code) And not just that, Perl alters its parser behaviour live (and scoped to the module!) so remove `'signatures'` from `use` and you get: $ perl5.30 sig.pl Malformed prototype for main::my_subroutine: $foo, $bar, $baz = 'fury' at sig.pl line 7. But leave it in and there's no parse error. No magic preprocessed comments or fake code trickery like JS (which has a commitment to backwards compatibility as well) has to do[0]: To invoke strict mode for an entire script, put the exact statement `"use strict";` (or `'use strict';`) before any other statements. (They had to make it a string in void context instead of a comment because comments are removed by JS obfuscators, but it's essentially a magic comment/preprocessor directive) [0]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode#strict_mode_for_scripts https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- newaccount2021 4y ago
- deleted 4y ago[deleted]
- johnmc408 4y agoLooking forward to v7 and intro docs that only use "even more" Modern Perl. For a bigger push, we should all volunteer on those "Do X in Y" language sites and add Perl examples. Same with Amazon Lambda and other opportunities where pick your language is available. Also a modern OO seems nice, though not sure what is in it. Would also like to see a default async library (maybe POE, but I never used it and find the name a bit strange for a default...but then I like Tokio...) Not my area at all, but an opinionated way of async seems nice.
- thesuperbigfrog 4y agoThe current state of Perl 5 for Python fans: Perl 5: I'm not dead! TIOBE: 'Ere! 'E says 'e's not dead! Internet: Yes he is. Perl 5: I'm not! TIOBE: 'E isn't? Internet: Well... he will be soon-- he's very ill... Perl 5: I'm getting better! Internet: No you're not, you'll be stone dead in a moment. TIOBE: I can't take 'im off like that! It's against regulations! Perl 5: I don't want to go off the chart.... Internet: Oh, don't be such a baby. TIOBE: I can't take 'im off.... Perl 5: I feel fine! Internet: Well, do us a favor... TIOBE: I can't! Internet: Can you hang around a couple of minutes? He won't be long... TIOBE: No, gotta get to Reddit, they lost nine today. Internet: Well, when's your next round? TIOBE: Next year. Perl 5: I think I'll go for a walk.... Internet: You're not fooling anyone, you know-- (to TIOBE) Look, isn't there something you can do...? Perl 5: I feel happy! I feel happy! ===================== You can write Perl in Latin: https://metacpan.org/dist/Lingua-Romana-Perligata/view/lib/Lingua/Romana/Perligata.pm https://metacpan.org/dist/Lingua-Romana-Perligata/view/lib/L... or Klingon: https://metacpan.org/pod/Lingua::tlhInganHol::yIghun https://metacpan.org/pod/Lingua::tlhInganHol::yIghun or whitespace: https://metacpan.org/pod/Acme::Bleach https://metacpan.org/pod/Acme::Bleach
- deleted 4y ago[deleted]
- IncRnd 4y agoYou can even write perl to dump urls submitted by hn users, as this person I found does. [1] [1] https://gist.github.com/adulau/939629 https://gist.github.com/adulau/939629
- deleted 4y ago[deleted]
- LordKano 4y agoWhen I was an intern, my boss insisted that I learn Perl. I had not yet been introduced to the ways of the monks but I learned quickly. Perl is still my go-to language when I need to write something quickly. I have so many purpose driven utilities that I have written in Perl, that it saves me several man-hours of work every month.
- ksherlock 4y agoPlease don't blame bare word file handles on "C heritage" -- Some of the improvements were needed because in places Perl’s Unix/C heritage shows through a little more than we’d like it to in the 21st century. One good example of this is bareword filehandles. You’re probably used Perl code to open a file looking like this: open FH, 'filename.dat' or die;
- tyingq 4y agoMaybe the thinking was that Perl's STDIN, STDOUT, STDERR, came from c's (well, stdio.h's) stdin, stdout, stderr? Which then inspired the bad idea of expanding on that?
- ksherlock 4y agoIt's more from sed/awk/shell I suppose. eg, open FH, "<filename" vs FILE *fh = fopen("filename","r")
- tyingq 4y agoFor the <,> and variations, sure. Though IO::File has been there a long time and looks a lot more like your C example. IO::Handle also. Supports, for example: $fh = IO::File->new("filename", "r"); Or, as with C, things like O_WRONLY|O_APPEND in place of "r".
- 0xbadcafebee 4y agoI still use Perl whenever I need to get something complex done quickly. Whether it's the handy command-line switches and features for easier one-liners, or just easier stream text processing, or easier external command execution, or the huge library of modules that often support things Python doesn't, Perl is my "fuck it, I just need to get this done" language. I can't wait for the day that programming languages as a concept are obsolete. It feels exactly like hand-tool woodworking. I would love to stop building tables and chairs over and over, instead just buy them from Code IKEA.
- wainstead 4y agoFor me it’s any kind of text processing; especially code generation for some one-off task, like churning out SQL or bash scripts/shell commands. Faster than doing it by hand. __END__ is one of my best friends because I can dump the input data right into the script. On the rare occasion I am irked whatever language I’m working in does not have format/write, which comes from the Fortran tradition iirc.
- mikejulietbravo 4y agoPerl receives such an unnecessary amount of hate
- michaelwww 4y agoI don't think it's hate. I think it's more "why would I choose Perl over Python?" Perl has a painful syntax, Python greatly improves on this with easy syntax. I don't want to have to relearn the syntax every time I reach for a scripting tool.
- mikejulietbravo 4y agoSure, but there are a lot of times where if you care about performance you should use Perl. General purpose? Sure, Python.
- autoexec 4y ago> Perl has a painful syntax, Python greatly improves on this with easy syntax. Regular expressions are way better in Perl. I increasingly find myself going back to Perl for RE heavy projects because it's so cumbersome in Python by comparison. I'm still undecided on if Perl needing semicolons everywhere is only 'as bad' or 'worse' than Python forcing you to worry about the exact number of tabs/spaces indenting lines, but I'm leaning toward python being easier in that respect. Still, when I have to get something done quickly, especially if it's an immediate need I don't see having to worry about later, Perl is what I turn to. Everything in Python becomes a "Project".
- heresie-dabord 4y ago> Perl has a painful syntax, Python greatly improves on this with easy syntax. I use Python and Perl. Some people who like Python want everything to be Python and "hate" anything that isn't Python. It approaches zealotry in some cases. Perl syntax is expressive and is similar to C, C++, Java, and yes Bash. These are successful languages too despite not being pythonic.
- michaelwww 4y ago
- orf 4y agoSorry, but what? The top features they highlight here are a print statement that adds a new line, a change to the bonkers default of creating some kind of implicit global named variable every time you open a file, representing time as an object (with a strftime function!) and… function signatures? I wouldn’t call this as “Perl moving forward”, I’d call this “Perl is still about 20 years behind everyone else”. Wait until they find out that other languages print statements let you customise the line ending!
- eduction 4y agoYa those were my thoughts exactly, and I used Perl heavily for several years. The number two feature they listed was released more than 22 years ago. Perl is fine for certain tasks, I have no problem with people who choose to use it, but at a certain point I'd argue it's better to learn a new language than try to use Perl for a new type of task.
- shp0ngle 4y agoIt’s a weird feature set to highlight; most of this is available for a long time. I didn’t know about the function signatures. It’s nice, I guess. But I don’t want to write perl again anyway.
- tyingq 4y ago>“Perl is still about 20 years behind everyone else” The version of Perl on your favorite Linux distro might be. I think that's the point the article was trying to make...that distros ship VERY old versions of Perl.
- deleted 4y ago[deleted]
- wwweston 4y agoThe `print` statement in perl has always behaved more or less as it does in the "other languages" you describe. `say` removes the need for anyone to write their own "I'm tired of the manual newline ritual" function and provides a standard for where the newline is added. That's a marginal convenience, but given the frequency with which people either do write their own or newline inconsistency gets encountered (or both), it's a reasonable one. And it's in pieces like this one not because it's a huge thing to crow about, but to illustrate the opt-in nature of incremental changes or sets of changes to perl. `say` is also about 15 years old, like Time::Piece. The author is not announcing features that are new to the whole world, just new to a certain audience, possibly including the author. This is also true of the filehandle scoping feature (which is 22 years old). If you find the old bare filehandle scope behavior only notable enough to hurl a drive-by "bonkers" at it then I suppose that's one way of advertising that you haven't spent much time thinking about unix shell utilities and associated features/issues. Function signatures are slightly younger than typescript, or at least, the most familiar syntax for them; both the old and more recent means are essentially naming a list of arguments. In general: perl is an opportunity to think about programming languages differently. There's a lot of contexts in which I never use it anymore, but it's rare to find people with substantial insights who casually disparage it.
- HeckFeck 4y agoIt's not objective, but I find I have more fun in Perl than any other language. The initial jump was steep, but it helped that I already knew some shell. Now I think in references, I can guess what $_ is going to be, I slap in a big, my $val = s/<RE_HERE>/other_thing wherever I want, I could go on! I think $_ belongs to a different era, before levelling everything to the lowest common denominator became seen as a good thing. I found the limitations of its rivals less than compelling, and besides JavaScript is arguably more complex than Perl these days.
- shp0ngle 4y agough $_ I successfully hide away all my bad perl memories and now it’s coming all back
- wainstead 4y agoA few years ago I pulled out Higher Order Perl and started playing with some of the advanced features/techniques available in the language. And it was really fun! I think Perl was the first popular multi-paradigm language.
- jlv2 4y agoI spent the last 16 years of my career using Perl for about half of what I wrote. And I read the article. The title makes no sense. The article show anything meaningful as to why Perl has improved and is "not your Grandfather's Perl". Most of what the article talks about has been around for over a decade. If anything, it shows that Perl really still has under it the same old decrepit beast it always been hiding away.
- deleted 4y ago[deleted]
- CraigJPerry 4y agoI don’t really miss perl. I do miss the period when perlmonks was relevant to me. I haven’t really seen a similar community since. Maybe rose tinted spectacles on my part but i learned some really enlightening algorithms on there specifically in text processing and i recall it being a really warm community. Randall Schwarz used to run a podcast that was a total goldmine. Fond memories of listening to that on the train on the way to work.
- btilly 4y agoMost of the people who were on perlmonks are still around somewhere. Often with the same or a similar handle. (I added my first initial to mine.)
- wazoox 4y agoActually some still are on perlmonks :)
- collyw 4y agoI miss perlmonks as well, now that I do mostly python. It was like stack overflow, except discussions were encouraged. It gave you far more understanding than copying a SO answer usually does.
- HankB99 4y agoI've used Perl off and on throughout my career, even working at one job that was pretty much exclusively Perl. I've also used Java and C/C++. I've done a lot of work with embedded systems where C was the order of the day. But back to Perl. I always thought one of the best things about Perl was CPAN. I could nearly always find a module that would accomplish a specific task I needed and then I was just left to write the glue to implement that function (or functions) for my particular needs. I'm surprised CPAN is not mentioned. I wonder if it is still active. I also wonder about security of CPAN in todays environment. I find stuff like pypi and npm to be pretty scary. I haven't started anything in Perl in quite some time. All the cool kids are using Python so I've been sharpening my skills with that. (But it's all hobby projects these days.)
- guilherme-puida 4y ago> But back to Perl. I always thought one of the best things about Perl was CPAN. I'm a younger developer, so I wasn't around when Perl was super popular. I listened to the Corecursive episode about CPAN [0] and was really impressed. It's a good listen even if you're not that interested in Perl anymore. [0]: https://corecursive.com/tdih-cpan/ https://corecursive.com/tdih-cpan/
- wainstead 4y agoCPAN was definitely the envy of other languages for many years but I feel most have caught up by now.
- singingfish 4y agoKind of caught up. I don't think there's much like cpantesters and the strong emphasis on testing elsewhere.
- wainstead 4y agoAgreed, and the cpan shell too.
- 4y ago
- xivzgrev 4y agoPerl was created in 1987. My grandpa isn’t that young!
- SighMagi 4y agoGives me warm fuzzies to read new Perl articles. Such a fun, hackable and eminently practical language.
- calvinmorrison 4y agoI wish there was a callout to Modern::Perl; use Modern::Perl; and you get the lot of those features.
- draxil 4y agoSee also: use common::sense Which is also quite nice, giving slightly more opinionated defaults.
- auraham 4y agoI skimmed the article looking for a mention of a REPL or a new debugger. Perl is a great language but it lacks these tools. Sometimes I just want to try a couple of lines of Perl code in a REPL, but I cannot. Instead, I need to create a file. Also, when debugging with `perl -d`, I cannot use the Up arrow key to get the previous command. Not a big deal but the coding experience will be significantly improved with those tools.
- wazoox 4y agoI think that 'perl -d' needs to have Term::Readline to be installed to provide line editing. Otherwise you could use DDD, which provides an ugly but functional GUI to gdb, and perl -d. Or ptkdb which is better IMO ('perl -d ptkdb', requires the module and Tk).
- arunix 4y agoThis is what I do to get that functionality: rlwrap perl -dee https://linux.die.net/man/1/rlwrap https://linux.die.net/man/1/rlwrap
- heresie-dabord 4y agoThis is a simple REPL project and the readme lists other Perl REPLs. https://github.com/viviparous/preplish https://github.com/viviparous/preplish Perl's concise syntax makes working in a REPL a pleasure. Python has a REPL but the design of the language makes it expand both in length (for loops) and in width (tabs). I am a recent convert to working in a REPL first to test programming ideas.
- darrenf 4y agoThere are several, highly configurable (of course) and usable REPLs. https://metacpan.org/pod/Devel::REPL https://metacpan.org/pod/Devel::REPL https://metacpan.org/pod/Reply https://metacpan.org/pod/Reply Not to mention the Jupyter kernel: https://metacpan.org/dist/Devel-IPerl https://metacpan.org/dist/Devel-IPerl
- ksherlock 4y agohttps://perldoc.perl.org/perldebug#Readline-Support-/-History-in-the-Debugger https://perldoc.perl.org/perldebug#Readline-Support-/-Histor... ``As shipped, the only command-line history supplied is a simplistic one that checks for leading exclamation points. However, if you install the Term::ReadKey and Term::ReadLine modules from CPAN (such as Term::ReadLine::Gnu, Term::ReadLine::Perl, ...) you will have full editing capabilities much like those GNU readline(3) provides. Look for these in the modules/by-module/Term directory on CPAN. These do not support normal vi command-line editing, however.''
- ra88it 4y agoWhen I was about 20, I went to the local Barnes and Noble to find a book about programming. Picked up the O'Reilly Javascript book from around 2000. Had no idea what javascript was, just wanted to learn how to program and trying to pick the most popular language. $40 later, I got home and started reading! Very confusing, the first half of the book covered the language runtime (I think?) and the second half covered the browser sandbox, and it took me 200 pages to realize that I can't easily read or write to files on my machine with this language. Not what I was hoping for! Back to Barnes and Noble, another $40 and I came home with the O'Reilly camel book, Beginning Perl I think? Cover to cover read, probably the last time I did that with a programming manual. Decades have passed, I'm in the same camp as those that prefer Ruby now, but man what a breath of fresh air Perl was back in 2000.
- barrenko 4y agoAh Ruby, the only OOP without the stink.
- cutler 4y agoThat would be "Programming Perl" by Larry Wall. For me too it was the only programming book of that size I was compelled to read cover to cover. Larry is a great writer but maybe that's to be expected from a linguist. If Python is the number cruncher's favourite language Perl (and subsequently Ruby) must be the linguist's favourite. I got into programming after being intrigued by regular expressions in the advanced section of a chapter on Search And Replace in Dreamweaver 3 Bible back in 2000. At the end of the section there was a footnote to Jeffrey Friedl's "Mastering Regular Expressions" which I read cover to cover. Most of the examples were written in Perl as it was the only language with regex support so deeply baked-in so I had to then go to the source - "Programming Perl" by Larry Wall.
- ibiza 4y agoThe thing that kills Perl for me is its weak typing. Automatic variable coercions lead to data-dependent bugs. JavaScript has the same problem. For scripting anything longer than a command line, I'll take Python.
- xani_ 4y agoUh,those features are here for almost decade now, some longer IIRC. But man, just being able to write use v5.10 have been a blessing when you need to support some legacy infrastructure. Old Python broke after upgrades, Ruby broke, but Perl code keeps on trucking. In vast majority of cases the code changes were just "well, the new version of lib gives some warnings about deprecation, might as well clean it up a bit". The minority of cases has been Mojolicious breaking stuff again.
- balthigor 4y agoPERL was the duct tape of the early Internet. Remember CGI scripts in PERL on FreeBSD? Good Times.
- flukus 4y agoI deal with so many over complicated enterprise solutions that would be much better with this level of abstraction. CGI scripts are basically FaaS on your own machines.
- jandrese 4y agoAmazon Lambda is basically just CGI scripts hiding behind fancy math words.
- cutler 4y agoDon't forget Matt's Script Archive (http://www.scriptarchive.com http://www.scriptarchive.com).
- deleted 4y ago[deleted]
- alxmdev 4y agoI think of Perl as a Python-PHP hybrid. A pragmatic product of its time that will endure, and while I'm grateful for never needing it, I'm glad that it's a solid option still for those who do.
- hannibalhorn 4y agoPerl actually predates both of those!
- wainstead 4y agoI recall seeing my first PHP/FI page in the middle 90s. PHP was a godsend after you'd suffered with Apache's "server side includes" [0], which is largely what it was used to replace. Python's origin was as a teaching language (originally ABC I think?), and thus the simplicity of the syntax. It was kinda cool that Python was around for so long before it took off... I had the O'Reilly Python book way back in the 90s. Perl's influences were awk, sed, bash, C, Fortran, and Lisp. [0] https://docstore.mik.ua/orelly/linux/apache/ch10_01.htm https://docstore.mik.ua/orelly/linux/apache/ch10_01.htm
- Spooky23 4y agoI used to write automation for systems management with an old IBM product called Tivoli. It was the best job ever. The systems monitoring tool used ancient Perl4 (this was circa 2001 when Perl4 was like a decade old) and Prolog to handle event management.
- fijiaarone 4y agoI’m so looking forward to learning Perl 7 and all its quirks with my ($grandchildren) = @_
- Hippieblog 4y ago[dead]
- brazzy 4y ago> $time->mon # 1 - 12 > $time->month # Jan - Dec > $time->wday # Sun = 1, Sat = 6 > $time->day # Sun - Sat Seriously?
- raggi 4y agoThis is the readability of the Perl in the blog, captured on my system: https://imgur.com/a/EJFNO2U https://imgur.com/a/EJFNO2U
- cutler 4y agoPerl enabled me to take a business-owner's disorganised national spreadsheet of teachers, locations and contact details and turn it into a web application, freeing him from fielding phone calls all day and boosting conversions over a period of 15 years. Perl's superb regex handling was essential in extracting and gradually refining the data until it was fit to be entered into a database. From that point on Perl, along with PostgreSQL, literally ran the business while generating opportunities for hosting promotions with bigger companies. Those who (m|kn)ock Perl usually haven't spent a significant amount of time using it to add real value to a business.
- gyulai 4y agoSo, this is on the stack overflow blog. And Joel Spolsky famously thinks that to rewrite a codebase from scratch is the "single worst strategic mistake that any software company can make" [1]. I wonder if this is how you end up being a Perl user in 2022. [1] https://www.joelonsoftware.com/2000/04/06/things-you-should-never-do-part-i/ https://www.joelonsoftware.com/2000/04/06/things-you-should-...
- uhtred 4y agoEh? He's not wrong. for any serious (in production and actually being used by paying customers) software it _would_ be crazy to rewrite a codebase. I can't think of a compelling reason to. For the record, I became a perl user (for fun!) in 2022 because I was attracted to the text processing capabilities, the awesome documentation, the baked in regex handling, the way it's so integrated into unix culture, the fact that it feels like a nice and natural step up from awk or bash when I want to process text files or work with the filesystem, and also the fact that I just find python so boring. Oh, also Perl is a very powerful command line tool that can be easily piped into on linux. I don't think python or ruby are as powerful in that regard but I could be wrong.
- gyulai 4y ago> Eh? He's not wrong. It's wrong when stated as a blanket statement like that. It depends on the particulars of the case. I've worked in a company that's taken this dictum as gospel and took it to its absurd extreme where refactoring of any kind was forbidden. I would explain some dark corner of the codebase and everybody would basically agree that it was in bad shape. I would then explain what I wanted to do about it and people would say "Is that a refactor you're suggesting?" in a tone of voice that would be more appropriate when saying "Is it killing babies that you're suggesting?" As coincidence would have it, that was a Perl shop. So I speak from experience. And that experience has left me somewhat scarred. Imagine working on a codebase where any mistake you ever make you're just stuck with. And it's not just your mistakes, but other people's as well. And the mistakes just pile up and pile up and start interacting with each other in nasty ways and there's just no way out. I love being a programmer, but there is little in the world that I hate more than having to be a programmer under such circumstances. What's more is that the financial benefit of not refactoring is a benefit that usually accrues to those who are in power in a company and who don't have to touch the codebase, whereas the psychological cost of not refactoring accrues to those who have no power who are forced by the others to wallow in the muck. -- That's the thing that Spolsky consistently just doesn't get. He consistently represents the one-sided view of someone "in power". As a programmer under such circumstances, it really makes no sense to throw away your psychological wellbeing so that your company's owners can make more money, just like it doesn't make sense for a miner to give himself lung cancer so that the owners of the mine can make more money. Conversely: If you're the owner of a software company (or mine, or whatever) you should partially think of refactoring as an employee benefit that will pay for itself through increased productivity. It's a point that's very convincingly made by Tom DeMarco in his book "Peopleware" [1]. Asking your employees to dial down the quality of their output so you can realize cost savings almost never makes sense when you take into account the human side of the economic equation. You'll demotivate them and the losses in productivity will outweigh the cost savings. [1] https://www.audible.com/pd/Peopleware-Audiobook/B09WDR3P3V?action_code=ASSGB149080119000H&share_location=pdp&shareTest=TestShare https://www.audible.com/pd/Peopleware-Audiobook/B09WDR3P3V?a...
- publicola1990 4y agoIs it now a fully featured language in which to write any program? Does it have a networking stack? What about GUIs? What about numerical stuff?
- jasonm23 4y agoHmmm ... It is a useful stand in for sed. For everything else, there's anything.
- tomcam 4y agoLove the title. It also made me remember that my grandparents were born in the 1890s…
- xyzzy4747 4y agoI used a lot of Perl at various jobs. Nowadays I have my own startup and my code is a mixture of JavaScript, TypeScript, and Rust. Rust is good for anything sufficiently complex that you want to run quickly, have a small footprint, and want to be sure it works, while allowing for easy refactoring due to the strong type safety. JavaScript is good for anything you want to write quickly and the code quality doesn't matter as much (e.g. test scripts). It's also much easier to write than Perl syntax-wise and has great async support (unlike Perl). Also it has a much larger ecosystem of libraries and easy to use in IDEs like VSCode. Obviously JS/TS can also be used in both the frontend and backend which is another big advantage. TypeScript is sort of in between - if the JS codebase gets too large it should be written in TS instead. This makes the code less "write-only". Perl and PHP were pretty good solutions as scripting languages until JS added good async/await support, map/filter/reduce, and destructuring syntax in my opinion. JS probably requires the least lines of code to get a program working.
- robotguy 4y agoProbably not the place to ask, but some of you might find this interesting enough to take pity on me. I had an idea years back to build crosswords on the surface of a truncated icosahedron (https://i.imgur.com/qlLl434.jpg https://i.imgur.com/qlLl434.jpg) but I had no idea how to find sets of 5-letter words that would mesh like that. A very clever programmer friend of mine whipped something up in Perl over a weekend using hashes. Basically it pre-emptively runs through the dictionary and hashes all wildcard forms of a word back to the original word (l...s->leaks, etc), then at each stage of filling out the puzzle it just grabs the list of words that hash to the current pattern. Say you're looking for something that fits s..p. it would return [stops, swept, soupy] etc, then tries each recursively. If the list is empty, there is no solution at that level so it backs up and tries the next word at the previous level. I learned enough Perl to be able to make the code able to accept different polyhedra. The program takes quite a while to run on larger models, like say the rhombicosidodecahedron, so I've been looking for ways to speed it up. My background is with assembly and embedded C so I'm sure my implementation of these hash lookups would be slower than Perl's. Are there any other, maybe compiled, languages that have fast hash lookups like this?
- garfieldnate 4y agoI'm surprised with the emphasis on new features that such old features were highlighted. The 'say' function was added in 2007. Signatures were added in 2014, though to be fair they didn't stop emitting an "experimental" warning until this latest release.