in reply to Is it worth knowing Perl? Real-life examples please

everyone is "talking" Python (or R). And my problem is that I don't really have some good arguments

Comparing Perl to Python and Rust is like saying "I'm moving on from Linux, to Python!" It doesn't make sense, because Perl is different:

"Perl is, in intent, a cleaned up and
summarized version of that wonderful 
semi-natural language known as "Unix"."
--Larry Wall. Apr 6, 1994
No one is crusading to replace cat with a dog that does the same thing, because we already have cat, and Unix has been summarized by Perl!
"It seems like there’s an opportunity for a 
lightweight statically-linked scripting language. 
Something between Go and Python." 
--https://news.ycombinator.com/item?id=20111696
where Perl is really good

Perl is really good at almost everything it can do which is almost anything thanks to its flexibility, the devoted devs, and the generous people of CPAN.

where it is actually used nowadays

Perl is everywhere doing pretty much everything just like any standard unix tool so, astronomers (for real-life example), can cook up a clock after supper to watch Julian time fly:

perl -MAstro::Montenbruck::Time=jdnow,jd2mjd,jd_cent -e '$|++;print sp +rintf("%-22s","Julian day").sprintf("%-22s","Modified Julian day").sp +rintf("%-22s","Julian centuries since J2000.0")."\n";while(){$j=jdnow +();print"\r".sprintf("%-22s",$j).sprintf("%-22s",jd2mjd($j)).sprintf( +"%-22s",jd_cent($j));sleep 1}'
where it excels compared to languages

  • Perl can't be beat on the command line for speed of writing and sheer power of one-liners.

  • Then pasting one-liners into files for further development into complete programs.
    #!/usr/bin/perl =head1 DESCRIPTION Watch Julian time fly... =cut use strict; use warnings; use Astro::Montenbruck::Time qw[jdnow jd2mjd jd_cent]; $|++; print sprintf("%-22s","Julian day"). sprintf("%-22s","Modified Julian day"). sprintf("%-22s","Julian centuries since J2000.0")."\n"; while () { my $j = jdnow(); print "\r". sprintf("%-22s",$j). sprintf("%-22s",jd2mjd($j)). sprintf("%-22s",jd_cent($j)); sleep 1 }
  • Then abstracting the mojo out of the programs into modules to reuse the code.

  • Then back to one-liners, using your new modules, to repeat the cycle of virtues.

    The more tools in your programmer's box the better, so learn some trendy languages to talk to the kids. Meanwhile cat, sed, awk, cut, tr, grep, diff, patch, head, tail, sort, bash, perl and more written in C continue to make the world go round. "Let's talk about the language your favorite language is written in!" ;-)