Follow up: where do you see it going.
Full disclosure: never implemented anything useful in perl in my personal or professional capacity for the last decade, except for debugging a few scripts here and there.
Follow up: where do you see it going.
Full disclosure: never implemented anything useful in perl in my personal or professional capacity for the last decade, except for debugging a few scripts here and there.
I've used Python when it was convenient, but I dislike it. So Perl remains my go to when I need to process data for more than a shell script.
Things I've written in Perl that I've run recently (or are croned so they run frequently) include: scripts to monitor shared directories for changes (kqueue) and publish the changes to a remote server so my spouse can drop images or other files to be shared on a share and get a link to send, or edit a recipe and check it from the web while shopping; my monitoring script that checks if my computers are working and emails me if not, it also reboots my dsl modem when it needs it; (for work) a tool to grab stats files from production, compute a summary, and then upload it so clients can be routed to the servers that are best for them.
I've done all sorts of stuff with Perl in the past, it's a very capable language.
Then I discovered one of Perl's best kept secrets: it allows you to write real code, if you want to.
Now I'm back to being a regular programmer again but I just happen to be more productive with Perl than anything else.
I have written about it before[1] but it boils down to one thing: it runs anywhere with no modification or installation, even 20 years from now.
As to the future... Perl 7 is coming (:
I used it as my primary language for several years and it's extremely capable and intuitive. The learning curve of it's syntax is really only slightly longer than any other language. And I have the very strong opinion that syntax contributes less than 5% of readability and the rest is up to the developer to factor smartly and name things well.
With the light syntax and giant, well-documented community repos, it feels a lot like Python With References to me, which is honestly pretty great imo. I wish more people respected Perl.
I wish we could leave them behind as a fun phase of mass adoption of programming and fully switch to strongly typed languages alone. One can dream.
The other options built into your UNIX (maybe Linux) machine were:
- C
- C++
- tcsh/ksh/bash
- awk
- TCL
What would you have chosen?
golang/rust/c doesn't fit well the kind of tasks you would use Perl to do. There is simply too much verbosity and at some point in time you will bail out of the sisyphean nature of the task. Kotlin etc are more for mobile apps.
To me, back end work is-
1. Any serious application, that needs to run for years with performance - Java.
2. Glue work- Python/Perl.
This is why a lot of us still use vi/emacs; it's just what's available where we have to fix the problems.
I'll give you an example. I used to contract with booking.com, where they gave us a crippled little windows "amazon workspace" over vnc which we had to use to talk to their systems. They're transitioning from a perl shop into a java one, so naturally they use an IDE. Unfortunately, they have configured this little workspace such that SSH mounting your dev VM into an IDE isn't possible (due to it not having a workable ssh agent), and you can't install anything not pre-approved (so x11 forwarding a locally installed IDE is right out).
Minor changes could have been made to these workspaces to address this; requests for which went ignored for years.
The only thing I could rely on was what I am used to writing perl in. An SSH console session with vim and tmux.
I was quite glad to have java experience from before the days when java IDEs were any good. I'd have been screwed if I didn't know how to use the debugger and javac directly.
We've all had to work with our hands tied behind our backs often enough we just "skip to the end" and use the tools we know for a fact will always be available.
It's probably that same reason that perl persists to the level of popularity it has. Like vi, I know it's going to be there on basically any server I have to work on, and the client probably doesn't care/want or even know how to provision me something less primitive.
My most recent task using it was writing a backup script that connects to various systems, archives stuff, then copies it to a NAS and then updates a backup log.
Before that I created a demo site for a business idea using Mojolicious (Perl web framework) + DBIx::Class (Perl ORM), and I believe we could have completed the project using them. But due to concerns that we couldn't find or pay Perl programmers when we scale we abandoned it for a rewrite in C#/ASP.NET. A heart vs mind decision, but business needs came first. I'm aware that I'm the only one of my age (early 30s) in my circles who has learnt Perl.
And that previous sentence is why I fear for its future.
I don't see Perl going anywhere. Neither back towards popularity, nor further into obscurity.
Making Debian possible. Allegedly, the German banking system is held together by Perl scripts. Which is good. Perl got 0 bitrot. And you don't want your bank account to rot, do you?
I wrote a different Perl script as a Sysadmin 20 years ago and used it last year. Still works.
Another time I was doing something and wanted to grok some horrid DSL (cough HCL cough) and in 20 minutes wrote a script to parse thousands of files give me what I wanted. Still use that script.
Where's it going? No idea, don't care, I'll probably keep using it for the next 25 years.
There is a never-ending amount of work for people who are good at modernizing older mod_perl/cgi stacks into psgi, and profiling/optimizing stuff.
Where I see perl going:
I see the big firms running away from it as fast as they can, and getting pikachu face when they inevitably get second-system effect, but nevertheless doubling down, because admitting failure is a no-no unless during a reorg.
I see the mittlestand and small biz expanding their existing use of perl, as they cannot afford to re-tool. Perl programmers will continue to have active careers for another 20 years, which is at least as long as I need to remain employed.
The language itself will continue to evolve at a snails' pace due to being design-by-committee since our BDFL retired. Thankfully this doesn't seem to be a particularly serious problem, as no advances in programming language design have come forth which are the kind of quantum leap in either dev productivity or performance to matter for our use cases.
Pretty much anything that has to run on Unix(or unix like machines). Its special niche is glue code and automation related work. Use case for that happens quite frequently than one imagines.
There is a also a 'blub' nature to it as well. Many times unless you have used a tool, it can be hard to see what use case it fits in. Last two weeks I had to do a fairly heavy automation related thing at work. Bash was not suitable because the code would get big as the situation evolved. The tool has to be something using which is present everywhere(rules out things like golang, java), something in which you can rapidly prototype, something that is very good at manipulating text and something that works very well with Linux utils(Rules out python, golang). Over two weeks its size grew to something like 3K lines, and I have used it to automate hours of boring manual work, overall I think I ran it like 30 times or so.
Perl is also good at generating text which has some structure. So I have used in the past like a macro utility in languages that don't have macros. Basically I generate code using Perl. I have used this to generate python, pig and even java code many times.
Other types of work are for glue, like cron scripts, clean up, regular test scripts, rapid prototyping etc.
CPAN makes the whole experience awesome. Its still the fastest evolving library base compared to any language, only competition may be is js. You will find a library for nearly anything you want. And for something that you can't find, Perl is good at rapid prototyping. Compare this with something like Clojure, where even language goes without maintenance for months. Perl is still actively developed.
Another big factor can be commitment to backwards compatibility, you can be sure your scripts from years back will run on newer versions of Perl.
>>Follow up: where do you see it going.
Perl is here to stay. Its installed on nearly every machine you can put your hands on, and even teams don't use it, Over the years I have seen individuals use it as some sort of a personal automation and productivity language. Like a secret tool.
I guess a lot of banks, telecommunications, manufacturing and early internet companies use it heavily till date.
Basically so as long need for automation exists, Perl would exist.
My understanding is that Perl is still somewhat popular in the sysadmin world - where just being able to push code that works is valuable.
Usually much more concise, readable and faster.
perl -pi -e 's/change this/into this/g' filename(s)
-p assumes an input loop around your script. Lines are printed.
-i in-place editing of files
-e may be used to enter a single line of script. Multiple -e commands may be given to build up a multiline script.
Combined with "find" with -exec and/or pipe the filenames into xargs and you can do a global search and replace across a whole tree of files.
Also I recommend adding a backup for inplace edits.
man perlrun recommends -spi.orig