Perl is Dying thehftguy.com3 years ago in #Dev Love597

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 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: #!/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: 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: <?php foreach($_GET as $key =&gt; $value){ echo $key . ” : ” . $value . “<br /&gt;rn”; } ?&gt; What was the bug? HTTP headers MUST be separated by rn 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++ 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 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…

Like to keep reading?

This article first appeared on If you'd like to keep reading, follow the white rabbit.

View Full Article

Leave a Reply