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

I am always happy to see Perl being used in *some* unix administration tools where shell scripting logic is inefficient or insufficient. My Unix purism starts when I see Python or Java(!) being used for such tools. And what's the deal with the different versions of Python? DNF - Fedora's package manager - is written in Python. It's ok but right now I am getting random seq faults after an upgrade - I do not know where to start debugging it. Totally in a loss. It is said they try to convert DNF to C and for a good reason.

I have used Perl for website scraping a lot: 1) it has quite a few user agents to choose from, even curl, for fetching the webpages, 2) it has adequate HTML parsing modules, 3) it is super easy to use a regular expression to filter your results. Sure one can do the same in Python (or Java) but using regexes there, it is so tedious, for me. Give me the ol' m//g m// (edit:ouch!) form any day.

In Perl one can inline C, which means you can run custom number-crunching routines or using external C libraries easily. So whatever deficiencies Perl has with number crunching (speed), inline C can compensate - if one is serious. There is also PDL which offers a lot of scientific computing support. And then there is Python with lots of libraries which is convenient, but I get no joy.

Perl offers Mechanize and WWW::Mechanize::Chrome for interacting with a web site via a web browser. That's really cool and can automate many menial testing tasks. (Mechanize has been translated to Python too). Add to that Perl's very good test framework and you can use Perl for lots of testing.

And then you have website backends. Once it was mostly Perl. Now there is a lot of php (last days of Rome anyone?) and possibly some Python. But there is joy in using Perl as a backend which also supports templates. (A totally subjective and personal view from my one-time experience).

You say Python or R. But they have very little overlap. Sure you can multiply two matrices in Python as you can in R. But I will not say it is "one or the other" but "one and some of the other" or just the "other".

Each programming language has its own culture. If you want to be happy programming in that language make sure you are happy with the culture. The critical question for you would be "Are you comfortable with many ways to do one thing? Or would you rather prefer there was just one way?". Answer that and you will answer your question.

P.S. Look mumy I haven't slanted Python today!

bw, bliako

Replies are listed 'Best First'.
Re^2: Is it worth knowing Perl? Real-life examples please
by GrandFather (Saint) on Oct 24, 2019 at 01:12 UTC
    "Or would you rather prefer there was just one way?"

    Actually two ways: Python and Python3. Having spent most of last night trying to get someone else's Python script running to analyse a few astronomical images and utterly failing partly due to Python/Python3 issues I feel no great warmth for Python/Python3 and Pip/Pip3 at present!

    Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond