3 ms·
Perhaps my experience with Perl is similar to that of others who have been programming since the 1970s. I loved Perl back in the day, when it seemed like a gre
by bluenose69 6y ago
Perhaps my experience with Perl is similar to that of others who have been programming since the 1970s.
I loved Perl back in the day, when it seemed like a great alternative to constructing unix pipelines of awk, sed, etc.
Although I mostly used Perl for interactive use, I also found it helpful for quite a few short programs, say in the 20 to 200 loc category. But I noticed a problem: these programs were tricky to understand a year later. Perl was still useful, mind you, but just not as pleasant at the edit stage as it was at the writing stage.
And then Python came along. It soon became clear that Python programs would "age well". For quite a while, Python and Perl coexisted in my toolbox.
And then Perl started to drift into it's present state. All the new goodness (and I'm sure it is good) just seemed to come at a cost of more complexity. But why should I learn the new way of doing Perl, when Python was already filling the gap for that sort of work?
Gradually, my use of Perl decreased, from every hour to every week, to ... well, never.
I wish Perl had just gone into bug-fix mode long ago, so that it could have remained a reliable and understandable tool for a certain set of tasks. And then I'd still use it for pipelines, as I use awk, sed and the rest.
- kqr 6y agoI started with Perl and Python much later (mid-to-late-2000s) and my experience is the opposite. Python programs aged horribly (just after 6 months it could be a half day's work to get the build working locally again) whereas with Perl programs, written correctly with plenty of tests, I could jump into them two years later and everything just worked exactly as where I left it off. I'm sure python has had several improvements in this regard since, but it just seems to me like it comes at a cost of more complexity (virtualenvs and whatnot.)
- ghshephard 6y agoI think the OP was referring to the readability of the code, versus the build pipeline. I'd have to agree with them - I could never understand my own Perl code 6 months after I had written it, whereas I have little difficulty reading anybody's Python code.
- bonzini 6y agoPipelines or, more in general, an escape hatch within shell scripts when awk doesn't cut it, are indeed my main remaining use of Perl. I used it recently for some JSON processing script, because I couldn't expect jq to be installed and I couldn't even know in advance if the Python interpreter was python, python3 or python3.8, but that was painful...
- senderista 6y agoI still use Perl for occasional one-liners in pipelines as well (where it's simply more expressive than sed or awk), but I've given up on it for scripting in favor of (first) Ruby and (later) Python. About a decade ago, though (long after I'd switched to Python), I found that a regex-heavy program I'd written for processing terabytes of JSON files ran several times faster in Perl than in Python. I wonder if Perl still has a noticeable edge in text processing speed?
- cutler 6y agoA Perl regex is certainly more performant than the Python equivalent however I was surprised to find one of PHP's .ini options enables regex performance which surpasses even Perl's.
- tragomaskhalos 6y agoI would always use Python over Perl for ad-hoc scripting jobs above a trivial level of complexity, but would worry about its performance vs Perl for more permanent tasks. Worked on a codebase that has a lot of Perl glue, including a lot of text munging, and tbh whilst rewriting that stuff in Python would mean that it's not reliant on grey old geezers to maintain it, I would worry about the performance hit. Wonder if commenters have any explicit comparisons they could share.
- dkarl 6y agoI think there is room for a tool that is used for the same purpose as awk and Perl one-liners, but feels more familiar to 2020s programmers. Something that intentionally doesn't scale up to complex scripting, and is designed from the beginning to be relatively readable and learnable for people whose background doesn't already include the old-school command line text processing tools.
- bsder 6y ago> Although I mostly used Perl for interactive use, I also found it helpful for quite a few short programs, say in the 20 to 200 loc category. But I noticed a problem: these programs were tricky to understand a year later. Perl was still useful, mind you, but just not as pleasant at the edit stage as it was at the writing stage. This. Exactly. I had to start bringing printed out Perl code to my job interviews in order so that the interviewer was in my subset of Perl. And then the interviewer was lost, but that was better than him thinking that I didn't know Perl. That was a giant red flag that I needed to be using a better language. I jumped to Python in 1996, arguably at the height of Perl's popularity, and never looked back.