Hacker News new | past | comments | ask | show | jobs | submit login
Perl is dying (thehftguy.com)
122 points by user5994461 on Oct 7, 2019 | hide | past | favorite | 163 comments



> That makes one wonder about who else is still using Perl? if any? Can’t remember the last time I’ve heard about it.

Perl, like many other languages, has its own bubble. I'm using Perl daily at work. I used Python for a while, but the Perl job market was just too nice to pass. I have a backlog of clients interested in Perl work longer than I can handle, and they don't mind my requirements because they have no one to replace me with.

Is that a sign of a dying language? Probably yes. But to be honest, if it's about to become the next COBOL then I'm looking at a lifetime of profitable work with little to no competition :)

BUT: > Nothing personal with Perl. Just doing stats

Perhaps a little bit of research could help your point as well. The CGI example you mentioned is broken, but is also using a module (CGI.pm) that's been bad and wrong for so long that even Perl, with its eternal love for backwards compatibility has removed it from Perl Core. That's a sign of Perl's marketing problem, yes, but it's hardly a real indication of a language that's too old to care about fixing itself.


I have the same experience. A healthy portion of my time (25% is my estimate) comes from Perl freelance work. The amount of 'legacy' systems that run Perl and need maintenance is staggering.

If it weren't for the current Python hype (AI/ML and devops), I'd have more project that require Perl than Python.


>>> The CGI example you mentioned is broken, but is also using a module (CGI.pm) that's been bad and wrong for so long that even Perl, with its eternal love for backwards compatibility has removed it from Perl Core.

The CGI example is straight copy/pasted from the official Perl guide, November 2018. https://www.perl.com/article/perl-and-cgi/


...which says

> Warning you probably don’t want to use CGI for modern web development, see Why Not to Use CGI.


It's just a trivial example to show what the languages look like with variables, loop and print.

CGI is not used to deploy web applications anymore, I am aware of that. That's a far leap from saying the module is "broken, bad and wrong".

Another commenter pointed out that there are typo in the example so it doesn't work.


> The CGI example is straight copy/pasted from the official Perl guide

I don't know any official Perl guide? This is a blog post.

The illustration image (I gather this is what confused you) is from a 1998 book...


It's also the only example that could possibly make PHP look good, because it's the problem domain PHP was invented for. Nobody is innovating on Perl's CGI so it's not going to make use of any improved language features from the last 20 years.


It says the Official guide to programming with CGI.pm on the cover. This is just like a book on antique furniture restoration.


There's quite a lot of perl about. It seems to have a strong niche in accommodation booking platforms (booking.com and others), and recruitment software (ziprecruiter and others). As well as big chunks propping up various enormous companies (think banks and tech).

Perl lacks uniformity of syntax which is sort of a problem, but it does excel at helping to manage the mess that is real world problems.

Personally aside from getting sucked into ~ 30% devops over the last few years, I've had trouble finding decently paid work that isn't perl. Last time I got laid off I had an alternative offer within an hour.


I have been programming in Perl since the mid 90s. I still use it every day but in more modern sense with Moo.

I am curious, how do you find clients who need Perl programmers?


Perl won't become the next COBOL, as COBOL only got that way because of the reasons outlined in the article: the financial sector used it extensively, and their systems are too mission-critical and they're too afraid to break things by upgrading.

Contrast with Perl, which was mainly used by niche hackers (in the original, respectful sense), used in the types of products that live by the SV valley motto of "move fast and break things".


> Contrast with Perl, which was mainly used by niche hackers (in the original, respectful sense), used in the types of products that live by the SV valley motto of "move fast and break things".

Umm, no, I think you have a very poor idea of what Perl was and is used for, and who used it. I imagine Perl is still in heavy use (if not heavy development) in the back-end of some Banks. Perl was also used to power many of the web circa 1999. Some of the big names that used it are Amazon and Craigslist. Perl was one of the main languages used on the internet pre-2000. Much has changes since then, but let's not rewrite history to completely ignore Perl's role in where we are today.


Amazon and Craigslist still use it. Craigslist extensively and ongoing. Amazon according to my understanding did something with a (rather crappy) perl templating language to compile it down to C++ in a similar way to what Facebook did with PHP to hack. My understanding is that's still in use, but probably not undergoing extensive development.


I would quite like to do more Perl, but here in Europe I always find the salaries lower than for Python, which is my main language these days.


What’s the replacement for generating HTML fragments?

And what’s the replacement for collecting params?

I’ve used CGI.pm for both of those things.


I've not used Perl as my primary language in over a decade, but it remains my favorite.

I never used CGI.pm for generating HTML...the idea of using functions for tags seemed unneccusarily dense when HTML is a string and Perl is well suited to handling strings. Later I shifted to templating modules like HTML::Template and Template::Toolkit. I assume those are long defunct, but vfb the point is that they offered better functionality than CGI.pm

For parsing params, yes, I used CGI.pm.


You may probably want to take a look at Dancer. http://perldancer.org/

I have not used it but I have heard it is as lightweight as you want (in the sense that it may be huge but you only need to use the basics if that is all you need).

But it has been quite a while since I last used Perl for cgi.


Mojolicious for almost everything web related. Minimal dependencies. We also write lightweigt event loops with it.

http://mojolicio.us


Yup, me to. The CGI example is amusing. Are there people still using CGI.pm?


I love Perl. I first used it in 1994, around the time the early versions of Perl 5 were released. It’s hard to overstate what a breath of fresh air it was compared to the incumbent languages at the time, which were either very low-level (mainly C, and increasingly C++, at least in the Unix world) or else brittle and limited (various flavours of shell script, sed, awk).

Perl was a joy to use. Things that would have needed dozens of bug-prone lines of C could be done in just a few characters. Regular expressions and associative arrays were first-class language features! And, with the advent of Perl 5, there was enough scope for structuring code in a modular way that it wasn’t insane to write pretty large and serious programs.

The culture was delightful too. In those days it was centred on Usenet and mailing lists, and the general attitude was freewheeling and fun. When the first user group was set up in London, where I was living by then, I signed up immediately. That’s still the most fun I’ve ever had hanging out with programmers, and Perl was the glue that bound us together.

At some point I joined the developers’ mailing list (perl5-porters), just to see what they were up to. After a while I started to contribute: bug fixes at first, and later language features. That was fun.

So, Perl has been a big part of my programming life. But I haven’t really used it in anger for about 15 years. I still write Perl one-liners on the command line for ad hoc data processing, and actually I think Perl is still the best available tool for that, although younger coders tend not to be familiar with it any more.

But as for writing real programs? The world has moved on. There are newer languages that have taken the good ideas from Perl, but without so many confusing idiosyncrasies.

Perl 6 is another story, one that I didn’t have much part in. It’s a fun bundle of ideas, and maybe some of those ideas will spread and be useful elsewhere, but I doubt it will ever catch on itself.

I’ll always love Perl, but I doubt I’ll ever write another serious program in it – except maybe out of nostalgia.


As somebody heavily invested in Perl (just check my nickname, and I've written books about Perl (though Perl 6, not Perl 5)), my impression is that the size of the Perl community is rather stable.

In an overall growing market of programmers and projects, this means a decline of relative market share.

Sources:

* Every four years I organize a German Perl Workshop, and the attendance is roughly the same each year (80-120 people)

* Take a look at the commit stats of the Perl 5 interpreter at github, looks pretty stable over the past years: https://github.com/Perl/perl5/graphs/contributors

* Just general, unquantified impressions from Perl communities I vaguely follow (twitter, Perl questions on Stack Overflow, some IRC channels etc).

* Work use of Perl and and hiring for Perl positions


If you're not growing you're dying off


Says the pointy-haired boss type of person


Calling Perl (released 1987) "one of the first" programming languages is an extremely revisionist view of history to put it lightly.


Saying that Perl was one of the first languages is silly of course. It's nowhere near as old as LISP, FORTRAN, and C.

However, Perl is the first of its kind. Prior to Perl, one would have to hack together in either Bourne or C-shell a series of commands all strung together, poorly. Grep, sed, awk, and a slew of utilities were strung together poorly with any specialized manipulations coded in and compiled from C.

Perl was the first popular language that gave us first class data structures (arrays and hashes) along with the programming structures we were familiar with in C. The inline regex support obviated the need for sed and awk gymnastics to the relief of many.

All of the crazy things in Perl that drive so many people nuts today were derived from the shell scripting that everyone was familiar with at the time. Error codes in "$!", that seems familiar, if you're used to /bin/sh. Perl's syntax which mapped shell script idioms directly into language features made these conversions a breeze.

Perl was the first and best at being able to convert these awful shell scripts into something which was maintainable. This was also Perl's primary downfall. Because it was so easy to use, lots of people who were not first-class programmers were able to write a lot of not-so-nice scripts which made later programmers sad and angry. It was a victim of its own success.


Calling it "extremely revisionist" is absurdly generous even. Calling it "one of the first" programming languages is just flat-out wrong. Lots of other languages were around for many years or even decades before: COBOL, FORTRAN, Pascal, C, Algol, LISP, just to name a few. The idea that Perl is "one of the first" is just plain insane.


Once I got to that part, I took the article for satire. I'm still not sure whether it is.


Indeed. C++ seems to be having a bit of a rennaissance now, and that was created in 1979!


Corrected. You're the second person pointing this out.


What's the alternative to Perl for the sort of file conversion and text processing that can be done with a Perl script of about a hundred characters that I can type in and edit on the command line? Or if I want a 100-line script that will work in 2029 the same as it works today and won't require any stuff to be installed first?

I don't like Perl, but since it's there, it works, it runs quite fast and I'm familiar with it, I'll probably continue using it for my own stuff for as long as I continue to use a computer, which is likely to be at least a couple of decades beyond 2023.


For one-liners, awk. For anything more complicated, I'm faster writing a 30-line Python script than a 5-line Perl script - and everyone involved, myself included, is happier six months later when we need to edit it.


For one-liners, I considered switching from Perl to AWK, but gave up because AWK behaves differently on BSD and Linux.

Btw: The book "Perl One-Liners" from No Starch is not bad for people who want to learn a bit of Perl to become "dangerous".


An expert Perl user will always be able to show some nifty program that could never be replicated in another language, or would be ten times larger and full of bugs if it were. If you play to its strengths, it is amazing. There is no better language for ingesting text in ad hoc formats and generating formatted reports. Hence the name.


The Practical Extraction and Reporting Language thing is not Perl's name, it's just a backronym that Larry Wall came up with. My personal favorite backronym is Pathologically Eclectic Rubbish Lister (I say this as someone who really loves Perl).


From `perldoc perl`:

"""Perl officially stands for Practical Extraction and Report Language, except when it doesn't."""


It seems like you are arguing that because it is in the official docs, that is where the name 'Perl' came from, but that is not accurate.

autarch is right, "Practical Extraction and Report Language" is a backronym --the language was named 'Perl' first, and that acronym (and others) were devised later ( see https://en.wikipedia.org/wiki/Perl#Name ).

Larry was originally going to include the 'a' and name the language 'Pearl'. However, at the time there was already a programming language named 'Pearl', so he changed the name to Perl ( again, see https://en.wikipedia.org/wiki/Perl#Name ).

This can be verified from multiple sources, including the "Learning Perl" book ( see https://en.wikipedia.org/wiki/Perl#cite_note-57 ).


It can be a backronym and the official name at the same time. Your assertions are all true but your logic is faulty.


Sorry, just got back to this.

I guess that depends on whether you consider an obviously tongue-in-cheek backronym to be "the official name". We obviously disagree on this point.


It’s quite a bold claim, do you have an example?


Nothing specific to which I can point but I’ve never seen a language with quite the utility of Perl’s format feature.

https://perldoc.perl.org/perlform.html


I love string encoded logic. Not joking.


There is the one liner bash syntax for Ruby:

The -n option processes lines, the $_ magic variable yields from STDIN:

    echo "Foo\nBar\nBaz" | ruby -ne 'puts $_.downcase!'
outputs "foo\nbar\nbaz"

The -p option processes lines and prints the output:

    echo "My String" | ruby -pe '$_.downcase'
outputs "my string"

Just using -e allows you to pull all of STDIN with gets:

    echo "My String" | ruby -e "puts gets.downcase"
is functionally equivalent to the last.

More references: https://www.notch8.com/bash-commands-ruby/


Maybe awk for text manipulation?


I always thought that the original idea of Perl was slapping sh, sed and awk together into one language.


Literally the reason AWK was created


Having extensively used AWK and PERL, I don’t agree. AWK works for simple things, but has significant limitations especially for more complex parsing you might do in a dozen lines of PERL. Subroutines don’t return complex structures, Strict mode declaration checking, hashes, foreach style iterators are much less functional or missing in AWK. Multi layer structures are also trivial in PERL (hash table or array composed of child hash or array). Finally, AWK versus GAWK versus NAWK compatibility is an issue.


AWK has been and will forever been under appreciated. It is a fantastic tool. I always preferred it to Perl myself.


I use it multiple times a week for printing/copying tabular data from space-delimited files. It's not the most arcane usage but it would probably take several lines to do what awk does in one. I don't even know much awk! Learning any bit of awk is worth every moment of the investment.

    cat somefile.txt | awk '{ print $1 "\t" $2 }'
On mac I pipe to `pbcopy`. Saves me several minutes each time.


Bash is actually pretty decent at this by itself if you don't have a lot of extra columns:

    cat somefile.txt | while IFS=" " read one two; do echo -e "$one\t$two"; done
IME the pattern matching is where awk really shines.


Also see basic Unix utilities like cut / paste (and colrm if your *nix has it, not sure if MacOS does) as these do the same column selection and printing and support simple options for delimiter and field number selection instead of writing a parser.

cut -d’ ‘ -f 1,2 < some file.txt


I do have a ton of extra columns I'm filtering out but that's really good. I'll try it on. Thanks!


I don't use it quite that frequently but awk/sed is a strong addition to the toolbox.


The use case you describe is a use case of diminishing value in an era of better IDEs and tools. Definitely a thing people can still want to do, but your average new hacker is likely going to lean towards a tool with fewer sharp edges so that they can be confident the file conversion came through correctly.

The question is whether future generations will be as familiar with it as we are.


Obviously just use J.


Better yet, K - it's even more cryptical than Perl :)


The problem of course, is that you have to be familiar with it. If you're facing this problem and don't already know Perl, you'll just use whatever your regular scripting language of choice already is.

Perl may be efficient at some tasks, but having to learn it to take advantage of that efficiency is basically never going to pay off.

Or put another way: https://xkcd.com/1205/ and https://xkcd.com/1319/


If we're going to go with xkcd, the "death date" reminds me a bit of https://www.xkcd.com/605/


>The problem of course, is that you have to be familiar with it.

This is generally what formal education is supposed to solve.


Kind of stupid article. Perl will be dead because there are less searches on it and Apple is deprecating all script interpreters (not singling out Perl) and RedHat has announced that python is not setup out-of-the-box. Bold predication - in 2024 there will still be plenty of Perl running.


Although not AWK! Apple has to keep it to still adhere to POSIX (which is still a relevant classification to many big buyers in government and enterprise). Maybe this will cause an AWK renaissance...


POSIX is mentioned. Removing it can't be an issue or Apple and RedHat wouldn't be removing perl/python. There's gotta be something we're missing out.

RedHat is specifically targeted to government and enterprise. They would be aware of that.


The thing that RHEL is trying to fix is to prevent customers from being tied to the system python/perl and should install a version that works for them and the application they are trying to run. People installing random modules into the same perl/python as is used for system startup/critical software has always been a problem but it is also one of those things that makes having a long term LTS nearly impossible because you can't separate the user needs vs. the distribution needs and trying to fix anything turns into backports to weird ancient versions. This way distros can package and update the things they need independently from everything else and not disturb the user, and also provide a more comprehensive suite of packages that also don't disturb the system space. This is similar to how Amazon Linux is setup a bit.

A better example is a user I should be able to install python 3.7 and use it, even if the system libraries for the core packaging is based on python 2.x. Traditionally most users would just build their system scripts on python 2.x (because it is there), which means that if you upgrade the distro from RHEL X to RHEL Y (which brings a python 3.x) you break a user's environment. This was a constant problem when you were trying to go through the RHEL 5-6-7 upgrade paths among other things.

It hopefully will be resolving the issues of people and packaged software using weird old versions because it is there and breaking when something changes. My favourite example is having to write in ancient bash just to support MacOS which still ships bash 3 something.

In a shorter version, the interpreters are still there and buried, just not on $PATH and given to the user as a what they should use.

(This is opinion based on how I have seen people abuse systems and try to upgrade them over the years).


You know, perl is so ubiquitous, maybe we should vote to make it part of the next POSIX standard...


This article immediately reminded me of the classic "BSD is dying" meme. For those who haven't seen it yet, https://everything2.com/title/BSD+is+dying explains it, and several of the points listed there might also apply to this article: "[...] there is always someone who is more than willing to defend it", "easily knocked down facts", etc.


I immediately mentally inserted “Netcraft confirms” before the title of this submission. Glad I’m not the only one afflicted with this meme.


Ignoring the trolling aspect for a minute. There is actually a real discussion to be had on how BSD (or any software) continues to be developed and maintained, with support for current hardware

It takes a lot of work to keep software going, both developers and time. Wondering where it comes from. If it's free it's not getting money from users to finance that; if the user base is dwindling it also means there are few developers or other-company employees to work on it.


I really like perl. I started writing it in my university for sys/admin stuff and then went down the rabbit hole and investigated most of the nooks and crannies of the language. I like all the special symbols. I have no issue with reading code that I wrote five months previously. I like that it does not limit what I want to do programmatically.

In fact I recently snuck some perl code into production at my company a month or so ago: we needed an android app to post data to a backend where it could later be analyzed. Super simple. I wanted to get it out the door as fast as possible and due to the fact that it will be retired before the end of this year, I choose to write the backend in perl using MongoDB and Mojolicious. Then I saw that MongoDB is retiring their driver for perl[1]. I still went forward, but it was yet another reminder of the state the language is in.

It saddens me that perl does not get more love. It is a fantastic language but I can not justify teaching others it, or encouraging them to learn about it.

[1]: https://www.mongodb.com/blog/post/the-mongodb-perl-driver-is...


> Nothing personal with Perl. Just doing stats.

Very poor stats if you're extrapolating the time a market participant will be reduced to zero by looking at relative market position without also examining absolute usage.

That is, it's possible for something to have less relative market position but be increasing or static in total usage if the total market is increasing fast enough. That doesn't indicate something is dying, but it looks the same in graphs, and extrapolating from those lines won't show you what you think it is.

Is Perl in that situation? Probably not that much (but somewhat, I would argue), but if you're going to make a case on statistics, don't do a crappy job of it...


I understand Perl is still very popular, but I have always hate Perl with a passion. I felt it was just a bunch of arbitrary rules that you had to memorize vs a more naturally intuitive language. For example, if I remember correctly, Perl supported both "&&" and "and", with 2 different precedences. And the line of code that broke me was something similar to

$a = $src[$src]

At first I thought it was a bug, but then I realized that there must be two different variables called src, one was a scalar and the other was an array (I think that's what it's called it's been 15 years since I've used it).

Anyway at that point, I decided I hated Perl and would never use it again.


Don't most programming languages have a few idioms that really annoy newcomers?

I've been using Perl since the 1990's so when I see something like your example, my first thought is "oh no, somebody who doesn't know Perl wrote this Perl code!"[0]

I recently learned Python and while I think I'm pretty OK at it, I still have WTF moments from time to time. Like:

> from datetime import datetime # WTF? and yet standard!

I'm often tempted to rant about semantics and documentation culture in Python but then I remember hey, lots of people have similar criticisms of languages I know better, so maybe I should just give it some time.

I'm not saying you should have liked Perl, but in the programming landscape of 15 years ago you were passing up one of the most important things powering the Web.

[0]: never name two variables of different types the same thing; never use $a as a normal variable because it's sometimes Special.


> Perl – 1987

> Python – 1989

> Ruby on Rails – 2005

Ruby itself is 1995. In 2005 when Rails was coming out Perl had it's peak according to Tiobe:

> Highest Position (since 2001): #3 in May 2005[1]

> That makes one wonder about who else is still using Perl? if any? Can’t remember the last time I’ve heard about it.

Duckduckgo? [2]

Sure, Perl is loosing popularity but I don't think it's anywhere near dead or extinct.

[1] - https://tiobe.com/tiobe-index/perl/

[2] - https://github.com/duckduckgo?language=perl


Booking.com also still has a ton of Perl I believe.


I hate to be this guy, but Ruby on Rails is not a language, and Ruby the language was first release in 1995.


I don't think that makes you 'this guy' at all I completely missed that and it's a valid thing to point out.


Almost nobody was using Ruby in 1995. Perl, however, was everywhere.


Almost nobody was using Python in 1989 either. Clearly it's a mistake on the part of the writer and not some deliberate attempt at judging when a language became popular.


Author here. I put Rails instead of Ruby deliberately. I'm not sure if Ruby is significant enough to stand on its own, guessed not.


Thanks for clarifying. But that seems a bit unfair and arbitrary. Rails definitely boosted its popularity but Ruby itself is quite potent without it. Stripe has its systems written in Ruby without using Rails, for example.

If we apply the same standards for Python, shouldn't we track its popularity by when NumPy(Numeric) came into being? (1995)

This is supremely pedantic though, and I don't really care about arguing it here, so :shrugs:


Ruby was barely a blip on the map until Rails showed up.


having read the article I agree with only one point that the author makes: once Perl is removed from the default installs, it will lose one of its advantages, being there and working by default. People will likely shy away from installing an additional programming language.

The other topics there have been rehashed many times before and are little more than extrapolations and exaggerations - how could a language ever go extinct ... if anything COBOL demonstrates that languages do not go extinct.


> The other topics there have been rehashed many times before and are little more than extrapolations and exaggerations - how could a language ever go extinct ...

COMIT, TRAC, JOSS, FOCAL, and a few dozen assembly languages all would wave, but they're a bit dead at the moment.


Wikipedia has a list of major programming languages by generation: https://en.wikipedia.org/wiki/History_of_programming_languag...


Its not dead, but how much new code is being written in Perl? I generally measure th health of a language by how much contemporary use it gets.

I used to write Perl but I do not take it out of the tool chest anymore and I see very few Perl codebases in the OSS world.


> I used to write Perl but I do not take it out of the tool chest anymore and I see very few Perl codebases in the OSS world.

It's still haunting under the covers of many a proprietary app. It handles all the database processing for a fairly modern program I reverse engineered last year (so we could transfer from it to a new program without having to manually re-enter the 2.3million record database).

Heck it was only a couple years ago that macOS used Perl for string processing in libc. [0] (I believe it now forks to sh instead.)

[0] https://news.ycombinator.com/item?id=18920122


The OSS world, all the glitter, is just an iceberg to the ice continent of the software industry as a whole. There is still a lot of new mainframe code written today. And a lot of glue scripts are still written in perl at various software houses


The OSS world is all glitter? Huh, I guess all of those ancient Apache installations running mod_perl are more glamorous than we thought.

Ditto the busybox shells on a million embedded systems, but I guess that's a bit beyond most here.


I just don't see a reason to use it nowadays. Python is more verbose, but it's also easier to read and debug, and its tooling and package ecosystem is less chaotic.

And for small stuff, I just have Zsh, which is a perfectly suitable Perl replacement.


> how much new code is being written in Perl?

Nothing like a full answer to your question:

https://metacpan.org/recent

Alas, not nearly so active as it used to be, but still a fair amount of activity.


It's always there in every Linux distribution. And Oracle seems to like it as they include lots of perl scripts with their products.


I'm not sure using a very outdated CGI example as an illustration of why Perl is dying is all that convincing.

It says in the source article "you probably don’t want to use CGI for modern web development", then explains all the reasons why not, pointing you to modern frameworks such as Catalyst, Mojolicious and Dancer.

Not saying Perl doesn't have challenges with its popularity, but this isn't a very good case as to why it's dying.


It's just a basic example to show what the language looks like. Same in the 3 languages straight from the textbook and stack overflow.

Basic CGI script to show all GET request parameters. If you were writing an HTTP API, you would probably do something very similar although not running over CGI.


Ok but why not choose an example to show what the language looks like today, vs >10 years ago? Perl CGI is deprecated, so if anything using an example this outdated proves the opposite of your point.

Surely a more constructive comparison might be looking at a 1 page app in Mojolicious vs Flask, Express, etc?


For example the -signatures example on https://mojolicious.org/


There is no bug with `\r\n`. I checked the provided example, fixed `\N` to be `\n` (this bug causes a compilation error, so it would be noticed during compilation). The hex output is as follows.

    00000000: 436f 6e74 656e 742d 5479 7065 3a20 7465  Content-Type: te
    00000010: 7874 2f70 6c61 696e 3b20 6368 6172 7365  xt/plain; charse
    00000020: 743d 4953 4f2d 3838 3539 2d31 0d0a 0d0a  t=ISO-8859-1....
    00000030: 5041 5241 4d3a 0a                        PARAM:.
Note the 0d0a0d0a sequence following the character set. This is `\r\n\r\n`, as it should be.


In Perl, "\n" has a similar kind of platform-specific behavior like it does in some other languages (such as C). Its output is more or less defined as "whatever is appropriate on this type of machine". It's useful for printing for the console or writing to a text file that will be used on the local machine, but not for everything.

If you're building a message to go on the wire as part of a protocol that needs certain specific characters, and if you're trying to write portable code, then you shouldn't use "\n" (or "\r").

This is actually covered in the "perldoc perlop" documentation under the "Quote and Quote-like Operators" section (available at https://perldoc.perl.org/perlop.html#Quote-Like-Operators):

> All systems use the virtual "\n" to represent a line terminator, called a "newline". There is no such thing as an unvarying, physical newline character. It is only an illusion that the operating system, device drivers, C libraries, and Perl all conspire to preserve. Not all systems read "\r" as ASCII CR and "\n" as ASCII LF. For example, on the ancient Macs (pre-MacOS X) of yesteryear, these used to be reversed, and on systems without a line terminator, printing "\n" might emit no actual data. In general, use "\n" when you mean a "newline" for your system, but use the literal ASCII when you need an exact character. For example, most networking protocols expect and prefer a CR+LF ("\015\012" or "\cM\cJ" ) for line terminators, and although they often accept just "\012" , they seldom tolerate just "\015" . If you get in the habit of using "\n" for networking, you may be burned some day.

So, arguably it is a bug to write it that way, but not exactly a fault of the language since it is providing a facility to do something useful and also explicitly warning you against using it for something else.

One way to think of "\n" is that it's similar to localized strings. In both cases, you have a need to let the system render something differently depending on context (platform or user location/language/etc., respectively). It's helpful to have that abstracted away, but you should realize that magic is happening and that you generally shouldn't use it for machine-to-machine communication.


This was running on Linux?

That's odd. The bug works on Python. Wondering how Perl does the formatting to end up with \r\n.

Either way, still puzzling there is a typo in the official example.


You can find similar examples with just \n in the official Apache docs on CGI: https://httpd.apache.org/docs/2.4/howto/cgi.html

The solution for this puzzle is that mod_cgi will simply convert LF to CRLF silently.

(more precisely: it parses the headers the script outputs in a relaxed way and lets the server write them in a correct format later)


This is directly executed (without HTTP server involved, yes, it's possible to run CGI programs directly in shell) program on Linux.


A lot of comments seem to be equating dying with dead. So, let's agree that Perl is _not_ dead.

Is it dying? it isn't as popular as other languages, and it isn't being used for as many new projects. Therefore, you could say it is dying a slow death like a lot of languages before it. It will continue to be used in existing code bases for decades to come, but like Cobol it likely isn't going to be the go-to language for most projects.

Will Perl 6 change the trend? Maybe? I don't think we know enough to rule that out.

If it _is_ dying, I often wonder if it was a self-imposed death. If Perl 6 hadn't been delayed so long, we might be living in a world where Python didn't become the go-to language. But was that ever a real possibility? Could we have gotten to Perl 6 as "easily" as we got to Python 3? Anybody have an opinion on that?


what is a dead language exactly. Is COBOL dead, it had a version update just a few years ago.


I think there's two types of dead:

1. Dead as in hasn't received an update in years.

2. Dead as in very few people use it for new greenfield projects.


> For example, it doesn’t support functions with arguments,

Well, you can name your arguments if you want to. You can use hashes. Or you could just get a bunch of unnamed values.

I like this flexibity. I also like that you can make the language evolve without having to add syntax (something Java is suffering from).


This was mind-bending for me too. It seems like the author is just arguing that since the syntax is different it's worse? The flexibility in Perl is nice, and while references can be a real PitA, a weird assertion to just make.


One day my comment on the article might get approved showing that the syntax is also "modern" since like 2008! 2014 was formal support in the core of the language with `use feature 'signatures'` in version 5.20


Modern IDEs make syntax addition cheap. One of the primary advantages of perl is its terseness, but that advantage diminishes in an era of IDEs converting a few keystrokes into a hundred characters of (better self-documenting) code.


I used to write perl 20 years ago and haven't touched it in 15 years. I thought it already was dead, then alas I got a job where it still exists in massive undisturbed quantities of thousand line functions and scripts with no structure.

It feels the same as the anthropologists must have felt when finding an Amazonian tribe completely untouched by the modern world.


Perl was great when it came out, but there's a lot of better alternatives available ("better" in terms of robust language definition and diminished likelihood of a typo leading to a sound-but-incorrect program, which seem to be two things that developers value more over terseness in an era where IDEs assist with editing in verbose languages).

I suspect perl will always have a place (there are a million shell scripts out there handling issues people need solved), but it'll have a place like COBOL does; useful where it already exists, but not something you learn until and unless you need to edit a perl script.


I dunno, for certain task I think Perl is unmatched. Anything that would take more than a loop in bash to accomplish, but bash style work.


Other than C++ in high school, Perl was one of the first languages that I learned. At the time I was working on Unix systems in a closed off, secured area with no access to the internet. I was doing systems work, and the only tools I really had at my disposal was what was on the servers I had in the space with me. If I was lucky I got a system with a modern Linux OS on it like Red Hat, but sometimes I had to work on a Solaris UNIX system that was pretty bare bones.

The options for scripting were either bash or perl. After some digging around I found some scripts that other engineers wrote in Perl. Mostly using it for text replacement, regex, and basic server functions.

I was intrigued by the weird syntax and very powerful one liners, so I got some books and taught myself basic Perl. I started writing some quick scripts and it made me feel like I had a super power. Most of all, Perl was fun with all the different ways you could do things. It was like a puzzle.

Fast forward to my first "real" software job. Most of the code case was written in Python, so I started learning that. I wrote a couple scripts in Perl to do some basic text stuff that I thought would actually be less elegant in Python. While I thought I was quite clever, the other engineers immediately jumped on me and told me to never write any Perl code again. Something about "hard to maintain", "too many ways to do it", etc.

After that I never wrote any "real" code in Perl, but I kind of want to write some clever, convoluted Perl code just because I can.


But Perl does have functions with arguments, by all definitions. https://metacpan.org/pod/distribution/perl/pod/perlsub.pod#S...


Indeed, Perl does have named function parameters, the same as almost all modern languages - and I highly recommend using them.

(I use them throughout my code, except for modules that should stay compatible with very old versions of Perl.)

But folklore is a thing. Many people learned Perl before named parameters, and to be fair they took about 20 years to arrive (and are still called "experimental"!). People don't like to change now.

I think most people writing new Perl code still use the no-named-arguments idiom, just because it's old and familiar. Which makes code look more arcane than it needs to, to outsiders, unfortunately.


What does it mean for a programming language to be "dying" or dead?

If the language is being maintained and bugs fixed, is that dying? Can a language be complete? If it's not gaining new feature, does that mean it's dying? Is it the number of users that matters? What if a language has 10,000, 100k or 1 million happy users is that not enough?

If I wrote a custom language for me and a few friends or companies and there's 100 of us using it, no one would declare the language dying. So why do we use number of users? Is it dependent on the number of available jobs? new Books, articles, or library/modules published?

I'm not so sure, but I'll like to know what makes a language a dying or dead language.


If we found a planet with 350 billion humanoids, we'd say Earth is dying.

Until the last program is written, and the last machine to run that program stops.. can't really say it's dead.


Booking.com might keep it alive for a while


...and

    cPanel
    craigslist (https://www.craigslist.org/about/thanks)
    imdb (https://help.imdb.com/article/imdb/general-information/what-software-are-you-using-to-run-imdb/GH25HF4NB3C2KP9E)
    Companies who use Perl within London http://london.pm.org/advocacy/
    2018 sponsors (https://act.yapc.eu/lpw2018/)
    2019 sponsors (https://act.yapc.eu/lpw2019/sponsors.html)


Is DuckDuckGo not Perl as well?


I thought I added it; good catch +1


Perl 5 is like the jQuery of the server-side. Way better than what came before it, and only just a little worse than what came after. (IMHO) I kinda miss em both.


Any language put into the same relative popularity graph of other languages each with faster growth will always show up as diminishing.


Are you implying that COBOL and Delphi are fast growth languages?


This article displayed a malware ad to me, unfortunately. Flagging accordingly.


Author here. Screenshot?

Wordpress is showing ads automatically on all blogs, I might be able to pay and disable them if they are really as horrific as that.


I got this too. It redirected me to a fake Mac "system warning" page twice in a row. Sorry, I don't have anywhere handy to host a screenshot.


You mean opening the page got you redirected? Without any user action?

That is shady as f*. If WordPress is really doing that, the next article will be about wordpress distributing malware.


Yes, and with a pop-up designed to look like a Mac modal. You know the kind. :-(

This was on Safari 12.1.2. (Please don't judge too harshly - after the Browser Wars of the late 90s I'm largely browser-agnostic. :-) )


Perl is by far the most 'fun' language I've ever programmed. Once you get familiar with a lot of the idioms, it is extremely powerful, and the amount of processing you can do in a line or two of perl would take 10 lines in Java and 20 in C. And 15 years ago, these were the languages it was competing against.

That being said, I rarely use it anymore, and the reason is that once you stop using it daily, you quickly forget all the quirks of its syntax and its powerful idioms, and often I can't even read it without having to Google for help. And that is why it is dying - there are too many ways to do things.

Compare this with Python, which I've never really used as a day to day language, but every few months have to deal with some smaller project written in Python. I can jump in and get work done immediately because there are so few ways to do things. It is mostly just iterating through dictionaries, whereas Perl pushes you to think of everything as a regex or text.


> Perl is by far the most 'fun' language I've ever programmed. Once you get familiar with a lot of the idioms, it is extremely powerful, and the amount of processing you can do in a line or two of perl would take 10 lines in Java and 20 in C. And 15 years ago, these were the languages it was competing against.

On top of that, if you found some exception or special case later that you needed to add support for...it was usually just a quick tweak to the Perl program, but often half a rewrite in Java or C.

This meant (and still means in a lot of cases) that when you need to do processing on data whose format is not well specified and so you expect to not get it right until a few iterations, doing it in Perl can often be a lot faster than most other languages.


Perl won’t be extinct anytime soon due to its quality. Those who know it treasure it for the unmatched performance. Performance of turning ideas into reality. Ideas way beyond sysadmin and reporting stuff. Perl as a language, ecosystem, and community is well and kickin’. My 2 cents.


> "Perl was a popular programming language about 30 years ago"

That's inaccurate. Perl was released 30 years ago. It was quite popular by 2000, or about 20 years ago.

That said, something dies when it is no longer useful. Perl is quite useful and still comes bundled up with any modern Linux system.


And if sometime in the future Perl is no longer included by default, it will be installed "by dependency" just when you install packages like rsnapshot, CSF firewall, etc. and probably a big bunch of tools that nobody would guess are written in Perl (or some tools of the package)


We're still actively maintaining a whole bunch of TCL code, which is much farther down the list.

I never like Perl I remember it's heyday, just through sheer inertia it'll be around for a while.


I stopped using perl in '95 when I tried to make a multidimensional array and the syntax was nearly impossible to figure out. Switched to Python and was happy to see that the Numeric library was released that gave matlab-like array behavior to python.

I know some folks in the bioinformatics community who still write CGIs in perl and I really have to wonder why.


The Perl syntax to access a multidimensional array will be familiar to programmers in any other mainstream language:

    my $array = [ [1, 2, 3], [4, 5, 6] ];

    say $array->[1][1]; # Prints 5, as you'd expect.
It's really not that arcane.


"For the young readers who may have never heard of it. Perl was a popular programming language about 30 years ago."

1989 would have been the Perl 4 days. Perl 5 is twenty-five years old.

I don't write much Perl these days, unless for something inconvenient to do in Python. I have nothing against Perl, I just find that the young are much more likely to know Python.


As long as GNU autotools relies on Automake, Perl has some life left in it.


> That makes one wonder about who else is still using Perl? if any? Can’t remember the last time I’ve heard about it.

I don't even get statements like this. And what does 'heard about it mean' anyway.

Interesting I just pulled up another quick and dirty test compliments of HN Search (Algolia):

Last Year Story Titles:

Perl: 301 Python: 3,360 Java: 3,931 Ruby: 687 Ruby on Rails: 105 HTML: 214,423 Bitcoin: 1,398 Blockchain: 1,622

Adding Bitcoin and Blockchain I was just curious. But imagine if I wanted to prove popularity by using 'last year in Hacker News' in titles. It would appear that Python was 'more popular' than Bitcoin or Blockchain.

No question it's less popular than it was years ago for numerous reasons. Not sure the methodology used (google trends) tells the complete picture.


How many of those Perl story titles are some variation on "it's dead/not dead" though?


I would guess a bunch were about perl 6 since it was the new shiny.


How many stories were about BASH ? Everybody working on Linux is using BASH so it should have a very high score.


Perl has a well-deserved reputation as a "write-only language".


So the story goes. Care to relate some examples that show how it is worse than any other language?

I’ve seen mind-curdlingly horrible Perl of several varieties (novice, mad genius, and the biggest ugliest balls of mud you’ve ever seen), yet nothing has yet touched even the hem of the horrors I presented over-architected Java ravioli with acute patternitis.


I have seen absolute rubbish written in Python (which is supposed to be like pseudocode) and I have seen beautifally written Perl. It's 90% down to the individual writing the code. Perl just has a lot of syntactic sugar which can make it look like line noise to someone that doesn't understand it.


Any language you haven't taken the time to understand is write only. This is such a lazy trope.


When will it go away?

Simple. It will be dead when the last line of Perl goes out of production. I've just found a comment under a Rust video on YouTube that someone is still stuck with Fortran at work.


My sister is retired, but consulted with an old company she used to work for in IT. She found a comment in a header file from the 1980's. Which she wrote.

So yeah, code can hang around.


Off topic, but this blog loads an ad that disguises itself as a star-rating and comments indicator, which when clicked on takes you to this Mac security phishing site (at least on Safari).


Does Amazon still use Perl/Mason for site template rendering? There was still a surprising amount of Perl there when I interned in '08/09


Yes it does, but not for everything, and there's certainly less new work being done with it. It's impressive that much of that code just works and no one has touched it in a long time. A lot of breakage in that space is due to new people with no perl familiarity coming in and making changes--the pool of people that understand how that stuff works is shrinking.

(Source: This morning I worked on some perl/mason at Amazon and my team owns many thousands of lines of it).


Never used perl but I've tinkered with (Neo)vim under the cover, which is close I think? If so, it seems like a real nice language.


The only big Perl project I know is FHEM, a free smart home server that supports lots of IoT protocols and hardware.


I still use it every day!


No, it just (code)smells that way.


Perl is dead like punk is dead.


If only that were true.


TL;DR some people say there's demand for work in Perl and it pays well, others say they can't find Perl work, it doesn't seem to be advertised, and they have moved on to other things as a result. A curious bifurcation.

I keep hearing about how there is demand for good Perl programmers, especially ones who know other things too, because there's so much Perl out there which needs maintenance, modernisation, or conversion to something else.

Well, I've read and written more Perl than maybe I should have spent the time doing. I'd describe myself as an expert. (I even have source for the Perl interpreter open in my editor at the moment.) However, I have used many other tools as well, so I haven't stayed in touch with Perl-using companies much.

Yet, when I go searching, I don't see much work around if I search for Perl. When people talk about demand for experienced Perl developers/freelancers etc, I can't convince myself it really exists.

Take a look in the HN "Who's Hiring?" monthly posts. Search for Perl this month: Out of ~800 positions, exactly 1 is for Perl, and Perl is mentioned in passing in only 2 others.

HN is biased towards startups, but still. Elsewhere, on the Perl-specific job sites there are a few jobs shown these days, many are "not currently hiring", and the dates reveal they are keeping old ones in the list, perhaps to hide the fact that there's only a handful in the last month. It's really not much.

On other more generic job/contract sites, searching for Perl yields far fewer options, compared with almost every other listable skill I looked at. It is quite striking.

Perl is mentioned in job descriptions, but not usually as a primary skill.

I have seen other people say the same kinds of thing: One person says there is plenty of work for good Perl developers, another replies that they can't find any and where are these jobs, and nobody answers, or they are referred to a website that has hardly anything on it any more.

Curiously, from speaking with people who work at companies that have large Perl codebases that are still being worked on, and which are hiring, this could be down to job marketing, rather than skills actually required.

Job/contract adverts from those companies either don't mention Perl, or mention it only in passing "DevOps... expert in Kubernetes, AWS, Terraform, etc. ...able to write scripts in Bash, Python or Perl".

Yet talking to people who work in those same companies, reveals Perl is something they need and look for, but they aren't mentioning in their job ads. I wonder why.

In contrast, as far as I can tell, Python is a superstar in the job market right now. It's one of just a few top skills for high day-rate gigs (along with DevOps), and this surprises me in a way, because although Python is perfectly usable, and very well supported, it's not amazing, it's quite slow, and its standard library is messy and inconsistent too.

Yet, about half of the best paid contracts I see have Python as the primary skill. There are easily 20x as many roles listing Python as the main skill, compared with Perl mentioned even in passing.

So I'd say, Perl looks almost dead and buried in the jobs advertised market at the moment.

I've considering removing Perl from my resume because I think it might be starting to be a liability, a "does this make me look old" sort of thing. I use enough other things that it's not that important to me, but it's a bit of a shame. After all, as a freelance/consultant I have a substantial personal library to bring to the table, and it's a shame when I can't use it.

I can't quite decide if there is a hidden Perl-hiring market (that I haven't connected with because I've been doing other things for a few years), or if the people who say Perl developers are in demand are under a bit of an illusion, getting repeat work from the same places and not realising it's inside a small community bubble.


I second that, for like ten years on upwork and jobs.perl.org Perl has been barely present and on local job markets in most countries completely dead. I know people who moved on, found work with other languages and other technologies and who didn't, but couldn't find any work and had to do low paying non tech jobs.


The 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!

----

But seriously, Perl 5.30 just came out in May. It's not dead yet.


This seems like a nod to python. :-)

I started using Perl in the late 80s as a replacement to complex sed and awk scripts, but switched to Python in 2010. I still remember the day that mod_perl hit me, boom! Scaling inside Apache.. 1999 was a lifetime ago.


That's my primary use case for perl 'when it gets a little to complex for bash, just use perl'. Which is what perl was initially designed for. I never made the switch to python as it seemed to have more aspirations than that. I always thought that people who took perl further than 'great for sysadmin type tasks' were a little nuts.


I do know somebody who is using perl for a RESTful api backend for a line of business app. I was pretty fired up to find that, if only for nostalgia (haven't used it myself since undergrad studies required it [bioperl])


Larry Wall is 65 years old. I'm willing to bet someone is still using Perl in 2024 (just to be polite)


Isn't Larry Wall primarily using Raku?


I didn't say anything about primarily. I mean I have languages I don't use anymore, except on the odd times when I know they're the best solution.

on edit: anyway I guess my point really is the language will not be extinct until the last human user of it no longer uses it all. I don't think it is gone within 4 years.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: