Stories
Slash Boxes
Comments

SoylentNews is people

posted by Fnord666 on Thursday October 12 2017, @01:07AM   Printer-friendly
from the There’s-more-than-one-way-to-do-it,-but-sometimes-consistency-is-not-a-bad-thing-either dept.

Ruth Holloway at Red Hat's marketing site, OpenSource.com, has a retrospective on three decades of perl covering some history and a few of the top user groups. The powerful and flexible scripting language perl turns 30 at the end of this year. It is a practical extraction and reporting language widely used even today and has a dedicated community. It's ease of use and power made it the go-to tool through the boom of the 90's and 00's when the WWW was growing exponentially. However, its flexible syntax, while often an advantage, also functions as a sort of Rorschach test. One that some programmers fail. Perhaps two of its main strengths are pattern matching and CPAN. The many, mature perl modules available from CPAN make it a first choice for many when needed to draft something quickly or deal with a quick task.


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 5, Insightful) by Thexalon on Thursday October 12 2017, @04:22AM (7 children)

    by Thexalon (636) on Thursday October 12 2017, @04:22AM (#580973)

    Nobody complains about this "line noise" in human languages.

    That's not the complaint. The complaint is Perl that looks like this:

    @P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
    @p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
    ($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
    close$_}%p;wait until$?;map{/^r/&&}%p;$_=$d[$q];sleep rand(2)if/\S/;print

    That makes it nearly indistinguishable from line noise. Yes, you can write incomprehensible gibberish in any language, but Perl makes it easier than many others, especially with all its regex-related features.

    --
    The only thing that stops a bad guy with a compiler is a good guy with a compiler.
    Starting Score:    1  point
    Moderation   +3  
       Insightful=2, Informative=1, Total=3
    Extra 'Insightful' Modifier   0  
    Karma-Bonus Modifier   +1  

    Total Score:   5  
  • (Score: 3, Informative) by Anonymous Coward on Thursday October 12 2017, @04:42AM (2 children)

    by Anonymous Coward on Thursday October 12 2017, @04:42AM (#580976)

    Perl makes it easy, as does C, Javascript, PHP and others. Note: this program is *deliberately* hard to read, not just golfed, so the comparison should be made against IOCCC, obfuscated Javascript and similar code.

    If you used maintained production code to make your point, we would have something to talk about. I'd probably show you a gargantuan unification error spat out by a C++ compiler to rejoin, but at least we'd be talking about real code.

    I'm sorry but your argument is either ill-considered or disingenuous.

    • (Score: 3, Insightful) by forkazoo on Thursday October 12 2017, @07:09AM

      by forkazoo (2561) on Thursday October 12 2017, @07:09AM (#581015)

      Perl's enthusiasm for things like regex as a first-class language feature tend to mean that a lot of ugly perl gets written. Compare that to a language like Python where readable use of whitespace is considered a first class language feature, and it's not shocking that Python tends to be more readable than Perl in practice. Sure, it's possible to write ugly code in any language. But Perl is a language where it tends to be easy to make things ugly.

    • (Score: 2) by canopic jug on Thursday October 12 2017, @07:53AM

      by canopic jug (3949) Subscriber Badge on Thursday October 12 2017, @07:53AM (#581024) Journal

      Indeed. Obfuscated code contests exist for many languages. So the comparison is not apt.

      Perl also makes it very easy to write simple to read code as well. Programmers should naturally, but often don't, gravitate to writing clear, easy to read code because code is read many more times than it is written. So the best cost reductions can come from reducing the burden of reading, especially when other people or the passage of time is involved and therefore programmers need to aim to write clearly. It takes both practice and will. One thing prevents that are the rush to just throw work over the fence and call it finished, same as in any other language. If the coding team, especially the boss, accepts or rewards hard to decipher work then that's what will be produced, regardless of language.

      Messy code can be overcome by a group decisions to do so. An example is what the OpenBSD developers do with their C code by enforcing style(9) [openbsd.org]. It is certainly in any team's self interest and even in programmer's own self-interest to strive to write clearly. Yet some don't. Thus the comment about the Rorschach test.

      --
      Money is not free speech. Elections should not be auctions.
  • (Score: 3, Insightful) by The Mighty Buzzard on Thursday October 12 2017, @09:17AM

    by The Mighty Buzzard (18) Subscriber Badge <themightybuzzard@proton.me> on Thursday October 12 2017, @09:17AM (#581041) Homepage Journal

    Reading a highly optimized perl script is no more difficult than reading highly optimized C. You need mastery of the language rather than casual familiarity to do either. If you have that mastery, neither are difficult to read unless intentionally made so.

    --
    My rights don't end where your fear begins.
  • (Score: 2) by Phoenix666 on Thursday October 12 2017, @10:39AM (2 children)

    by Phoenix666 (552) on Thursday October 12 2017, @10:39AM (#581073) Journal

    Most code will look baffling if you run all the lines together like that. Vim has a great plug-in, perltidy, you should run.

    Beyond that it seems intelligible to me, once you understand regex's.

    --
    Washington DC delenda est.
    • (Score: 1, Funny) by Anonymous Coward on Thursday October 12 2017, @12:08PM (1 child)

      by Anonymous Coward on Thursday October 12 2017, @12:08PM (#581093)

      Most code will look baffling if you run all the lines together like that. Vim Emacs has a great plug-in...

      FTFY

      • (Score: 0) by Anonymous Coward on Thursday October 12 2017, @04:01PM

        by Anonymous Coward on Thursday October 12 2017, @04:01PM (#581188)

        No, Emacs doesn't have plugins. It has packages.