Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Stackoverflow blog: Why Perl is still relevant in 2022

by perlfan (Vicar)
on Jul 08, 2022 at 17:26 UTC ( #11145360=note: print w/replies, xml ) Need Help??


in reply to Stackoverflow blog: Why Perl is still relevant in 2022

stackoverflow for those who live and die by stack overflow x-D
@out = <$proxy>; for(@out) { chomp; ($parm,$n) = split/=/; if ($parm eq "totalmailattemptcnt") { $outh{"mails"}= $n; } elsif ($parm eq "goodmailcnt") { $outh{"goodmail"} = $n; } elsif ($parm eq "numattcnt") { $outh{"numatt"} =$n; } elsif ($parm eq "regexcnt") { $outh{"regmatch"} =$n; } elsif ($parm eq "viruscnt") { $outh{"viruses"} = $n; } elsif ($parm eq "spamcnt") { $outh{"spamcnt"} = $n; } elsif ($parm eq "relaydeniedcnt") { $outh{"relaydenied"} = $n; } elsif ($parm eq "bannedrecipcnt") { $outh{"badrecip"} =$n; } elsif ($parm eq "bannedsendercnt") { $outh{"badsender"} = $n; ...
No wonder Perl has the rep it does.

Replies are listed 'Best First'.
Re^2: Stackoverflow blog: Why Perl is still relevant in 2022
by InfiniteSilence (Curate) on Jul 13, 2022 at 19:02 UTC

    (This is part response and part rant...you have been warned!) I read through more of the article and finally know what your code snippet is referring to. Ouch. But this is actually a problem here at PerlMonks. I'll explain.

    I think someone familiar with Perl would read this article and grumble...'you are not helping...'

    The author has a fairly high score here on this site and, from what I have seen from his posts, can definitely write better code than that. He might have been thinking that producing simpler code would help newer developers or people unfamiliar with the language. However, that is really not helping. People need to learn more Perl by reading and trying things out. It is the responsibility of this site to educate people on this simple point.

    If we go back in time to 2019 (I purposefully did not go back too far so we could see recent results) we see one example of what I am talking about. The author's response is clearly wrong and no one has questioned him about it. See: How to loop through hash of array and convert into hash with key and value.. The answer given by the author is incorrect. The correct solution should not have had the key in the individual hashes (as shown in the expected results).

    The code provided actually produces this:

    #... 'Adam' => { 'total' => 22, 'days' => 22, 'name' => 'Adam' } #...

    There should be no name key in the hash.

    When I peruse the author's history I find more examples:

    • Re: sqlite show tables - "Here are some working snippets"...code dumping of old snippets should have gotten this author a downvote and been chided for posting irrelevant code and wasting space on the site.
    • array to string - The SQL used clearly will only return a single value (the count of users per a specific location) so I have no idea why no one (the author included) suggested using something like, $hash_ref = $sth->fetchrow_hashref to obtain the answer instead of looping to obtain a single value.

    I think PerlMonks users should avail themselves of the opportunity to point out issues with code here. Otherwise you wind up with people writing Perl articles elsewhere that do not represent this language very well. There are nothing short of brilliant posts online as well as books on Perl that can be referred to rather than writing code examples like the ones shown in the liked-to-article.

    And the rest is a mess...

    "It is still being used in CGI scripts. It is used in several sys admin tasks. Perl is still alive and kicking..."

    The entire premise behind this article is flat-out wrong. To summarize, it says 'oh yeah, Perl is still around...you can still use it for certain tasks.' Who says so? You?

    The author doesn't mention that Perl can fork or Perl can be used with Starman and other PSGI environments to achieve higher performance. No mention of the websites currently up and running using Perl (look it up -- IMDB, Zappos, Craigslist...the list goes on). There are even load balancers written in Perl. Instead the author keeps talking about CGI as if none of that exists.

    Some fellow named Steve summarized my thoughts in the comments of the article:

    "Each method and tool chain have their own strengths and weaknesses. CGI works for some tasks, Dancer works for other tasks. Use the right tool for the right job."

    Celebrate Intellectual Diversity

      AFAIS did the OP repost this SO blog entry to inform us. But he didn't write it! So what's the point in attacking him?

      Wouldn't it be more constructive to write a better opinion piece on Perl?

      You've listed valuable points, thanks for that.

      So what kind of help do you need to assemble a good article about "Why Perl is still relevant in 2022" ?

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

      PS: And yes, after looking more closely, these chained elsifs with eq make me cringe too. That's obviously better solved with an extra hash-mapping. But that's true for most languages.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11145360]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2022-09-25 14:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (116 votes). Check out past polls.

    Notices?