8

Perl is dying quick. Could be extinct by 2023.

 3 years ago
source link: https://thehftguy.com/2019/10/07/perl-is-dying-quick-could-be-extinct-by-2023/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Some personal reflections about the evolution and death or programming languages.

By the forces a circumstances, I had to reverse engineer and decommission a few Perl scripts in an old company earlier this year.

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

What is Perl?

If you want to see the numbers right away, scroll down to the next section.

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

  • COBOL 1959
  • BASIC 1964
  • C++ 1985
  • Perl – 1987
  • Python – 1989
  • Delphi – 1995
  • PHP – 1995
  • JavaScript – 1995
  • Java – 1996
  • C# – 2001
  • Ruby on Rails – 2005

Having used many languages over decades, more or less professionally (C, C++, Java, python, Haskell, Ada, PHP). Perl is truly unique in that it is genuinely unique and exotic.

For example, it doesn’t support functions with arguments, well, not like what exists today in mainstream languages. It’s also based on an extensive use of symbols whereas today’s languages are more about letters (keywords, variable names, function names, etc…). I think it’s fair to say that Perl is about magic symbols that do stuff, so much that 93% of random characters are valid Perl programs.

Here are some sample cgi scripts in Perl, Python and PHP for comparison. Straight copy/paste from perl.com and stack overflow. Can you understand what they do?

Plot-Twist: Stack overflow answers never work and this time is no exception. Can you find the bug(s)? (answer at the end)

Source: https://www.perl.com/article/perl-and-cgi/

#!/usr/bin/perl
use strict;
use warnings;
use CGI;
my $cgi = CGI->new;
my %param = map { $_ => scalar $cgi->param($_) } $cgi->param() ;
print $cgi->header( -type => 'text/plain' );
print qq{PARAM:\N};
for my $k ( sort keys %param ) {
print join ": ", $k, $param{$k};
print "\n";
}
# PARAM:
# foo: bar

Source: https://stackoverflow.com/questions/3582398/getting-http-get-arguments-in-python

import cgi
import cgitb; cgitb.enable() # Optional; for debugging only
print "Content-Type: text/html"
print ""
arguments = cgi.FieldStorage()
for i in arguments.keys():
print arguments[i].value

Source: https://stackoverflow.com/questions/2160382/how-do-i-grab-all-parameters-from-a-url-and-print-it-out-in-php

<?php
foreach($_GET as $key => $value){
echo $key . " : " . $value . "<br />\r\n";
}
?>

What was the bug?

HTTP headers MUST be separated by \r\n line ending.

These scripts do a basic print() generating a \n only when running on Linux. The output is thus invalid, although there is a chance the CGI server is robust to that specific issue. Note that PHP doesn’t expose raw headers and avoid this class of issues entirely.

Stats

The below charts show programming languages popularity relative to one another. Data from Google trend.

Most Common Languages

Link to Google Trends: Perl, PHP, Python, Java, C++

perl-comparison-popular-languages.png?w=922

Interesting finding from this chart, Perl was somewhat popular 2 decades ago, on-par with C++. Certainly popular enough to be considered among the major programming languages at the time.

Perl has been on the decline for a while. It’s reaching zero market share on this chart, what you’re seeing from 2018 onward is a single pixel as google trend is rounding up a near-zero value.

I think it’s fair to say that Perl can be considered a dead language. Definitely not something to use for new projects.

Niche Languages

Let’s compare Perl to other niche languages with low adoption.

Link to Google Trend: Delphi, Haskell, COBOL, Perl, Rust

perl-comparison-niche-languages.png?w=922

Well, still more popular than COBOL!

COBOL: A programming language running on mainframes used by financial applications. Specifically designed with support for integer arithmetic, transactions and records. Often considered legacy but really hard to migrate from because of how large, old and critical the typical application is.

Delphi: A programming language and IDE, based on Pascal, like C++ is based on C. Designed to write desktop applications. The IDE had a GUI editor to drag and drop widgets, very efficient and easy to use, maybe the first to provide that. There’s a good story on how it came to be eclipsed by C++, C# and Java over 20 years.

How about Perl for a new project. Isn't perl more dead than cobol. Perl is dead.
Meanwhile… in a Perl conference.

Lifetime Projection

Curious what’s dying faster between COBOL, Delphi and Perl? Let’s find out.

The graph below shows the linear and the polynomial trends for each programming language.

perl-comparison-niche-languages-projection.png?w=987

Note that both regression curves happen to overlap for COBOL. A stable and predictable language indeed.

If we are to believe the linear projections, Perl could be extinct by 2023, a few months after Delphi. COBOL would outlive both by far and go on to 2030.

Of course, languages don’t go “extinct”. Maybe think of it as having order(s) of magnitude less developers, up to a stage where there’s really not much left. Typically those making/selling the language/tooling will be among the last to know about it, as well as a few curious googlers.

All unmaintained software “decay”, because of hardware and software evolution, up to a point where it “suddenly” stops working and it’s “unfixable”. For example, the executable doesn’t run on Windows 12 or Ubuntu 24 for whatever reason, looking into it, turns out the compiler doesn’t run anymore either, ouch.

Software lifecycle is coupled to the lifecycle of the platform it’s developed with and runs on, so there is strong risk associated with little used or divested platforms.

When will Perl go away?

Perl and Python have always come pre-installed on Linux. If I remember well, there was actually a Posix specification or something that had it as a requirement.

Times have changed though and they’re both actively being removed from major OS.

Apple has announced officially that all interpreters are deprecated (Perl, Python, Ruby) and will not be available with the OS in the next version of MacOS.

RedHat has announced officially that python is not setup out-of-the-box in RHEL 8 and future versions.

It’s only a matter of time before other distributions follow. The next logical step is for Perl to go away, the only question is when?

Apple announcement: Future versions of macOS won’t include scripting language runtimes by default + discussion on Hacker News
RedHat announcement: Python in RHEL 8

Conclusion

If you’re thinking of learning Perl or starting a new project in Perl, you might want to reconsider.

Nothing personal with Perl. Just doing stats.

Next, need to figure out which one took longer to build, Microsoft Windows or the Great Pyramid.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK