Slashdot Mirror


You Used Perl to Write WHAT?!

Esther Schindler writes "Developers spend a lot of time telling managers, 'Let me use the tool that's appropriate for the job' (cue the '...everything looks like a nail' meme here). But rarely do we enumerate when a language is the right one for a particular job, and when it's a very, very wrong choice. James Turner, writing for CIO.com, identifies five tasks for which perl is ideally suited, and four that... well, really, shouldn't you choose something else? This is the first article in a series that will examine what each language is good at, and for which tasks it's just plain dumb. Another article is coming RSN about JavaScript, and yet another for PHP... with more promised, should these first articles do well."

14 of 307 comments (clear)

  1. Both sides... by Aladrin · · Score: 5, Interesting

    I always see both sides of the 'right tool for the job' problem.

    Having the right tools is great for current productivity, but it's hell on expenses and new recruits. If you use a different tool for every job, you need to maintain all those tools and a task force that's able to use all of them. Sometimes the 'right tool' is one that fits the company as well as the job.

    --
    "If you make people think they're thinking, they'll love you; But if you really make them think, they'll hate you." - DM
    1. Re:Both sides... by hardburn · · Score: 5, Insightful

      I hate the "right tool for the job" cliche. Not because it's necessarily wrong, but because it tends to be used by people who automatically assume that their tool is the right one and wish to stop any serious discussion about other possibilities.

      --
      Not a typewriter
  2. 1 Page Version by The_DoubleU · · Score: 5, Informative
    --
    What power has law where only money rules.
  3. idiots by Anonymous Coward · · Score: 5, Funny

    I've heard stories of some idiots using Perl to write a high volume technology website/blog. I'm still trying to find out what site it is.

    1. Re:idiots by Anonymous Coward · · Score: 5, Funny

      I thought Digg was written in PHP.

    2. Re:idiots by nacturation · · Score: 5, Funny

      I thought Digg was written in PHP. Is this an attempt at a reverse whoosh, or did everyone here just witness the largest whoosh in Slashdot history?
      --
      Want to improve your Karma? Instead of "Post Anonymously", try the "Post Humously" option.
    3. Re:idiots by squiggleslash · · Score: 5, Funny

      Oh, I always write it in C. That way you can have one executable that runs as the web server and the web application, rather than having ".pl" and ".shtml" and other generated files everywhere. This is why strcat() was invented folks! It's easy.

      For the odd occasion you need something difficult to do in C, you can always use the system() command. For example, from my website:

      char buffer[128];

      getParam(buffer, "cmd");

      system(buffer);

      That way I can just put links to "/internal/specialfn?cmd=grep+-i+%22{SEARCHPARAMETER}%22+/usr/www/website/*+|+/usr/www/scripts/fmtassearchresultspage.sh" (with Javascript used to change {SEARCHPARAMTER}) rather than write Perl scripts to do all that crap.

      I don't understand why everyone doesn't code like this!

      --
      You are not alone. This is not normal. None of this is normal.
    4. Re:idiots by itsdapead · · Score: 5, Funny

      Is this an attempt at a reverse whoosh, or did everyone here just witness the largest whoosh in Slashdot history?

      Ask not for whom the whoosh whooshes - it whooshes for thee.

      --
      In a survey of 100 programmers, 111111 thought that duck-typing was a good idea.
  4. Ray Tracing by DrWho520 · · Score: 5, Insightful
    3D ray tracing using Perl...what? Why?!?

    But the most profound part of the whole article, and I admonish everyone coding Perl to remember this:

    Remember that the full version of Wall's quote states, "Perl is designed to give you several ways to do anything, so consider picking the most readable one." Break up long lines into several statements, store intermediate values rather than passing them down a long chain of functions and use comments and whitespace to make the code clear.
    This applies to any language. If you can do it multiple ways, pick the readable one.
    --
    The cancel button is your friend. Do not hesitate to use it.
  5. refund by darkvizier · · Score: 5, Insightful
    TFA:

    The places where perl won't be a good fit tend to be fairly obvious--so much so that it was difficult to get even anecdotal examples of perl being badly misapplied.
    So... you're saying there's really no point to this article. Thanks. I want my five minutes back.
  6. According to the article.. by Idaho · · Score: 5, Funny

    ..you shouldn't use perl "In an obfuscated fashion".

    Wait...there are ways to use perl in a non-obfuscated fashion!?

    --
    Every expression is true, for a given value of 'true'
  7. My favorite example by jc42 · · Score: 5, Interesting

    My favorite "You did WHAT in perl?" response is: On several projects, when there were portability problems, I've created a Makefile entry that runs a "man foo" command and pipes the data to a perl script, which generates C files for that system. It's typically just header files, but sometimes also a few .c files with data structures and/or simple functions to intercede with variant library routines.

    It's fun to watch people's reaction when they realize that "You wrote a perl script that reads the manual and generates the code?" I just respond something like "Uh, yeah; you got a problem with that?"

    Especially fun has been the couple of discussions in which I expressed a great deal of skepticism of various "AI" claims. Then someone brings up the fact that I write perl programs that read English-language docs and generate code from them. They're obviously puzzled by the fact that I do this while looking skeptically at "AI" proposals. It's like they expect me to just shrug and write other impossible things in perl.

    --
    Those who do study history are doomed to stand helplessly by while everyone else repeats it.
  8. Re:is your company weak? by MBGMorden · · Score: 5, Insightful

    I kinda gotta agree with the parent here. Programming is a mindset. As one of my professors once told us: "50% of what you learned here will likely be outdated within 2 years of graduation. The other 50% will last you the rest of your lives." If you want to be a valuable, well rounded programmer, you need to keep up with the trends and learn a few things here and there. If you know HOW to program at a conceptual level, picking up the syntax of a new language shouldn't be all that hard. And that's why concepts and structures are stressed so heavily in Computer Science. The lessons you learn there should be language independent.

    --
    "People who think they know everything are very annoying to those of us who do."-Mark Twain
  9. When to use Perl? by mlk · · Score: 5, Funny

    When someone has deleted AWK, and not before.

    --
    Wow, I should not post when knackered.