Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Musing on Perl's "Just Try It" Amazingness

by ack (Deacon)
on Dec 12, 2007 at 17:36 UTC ( [id://656676]=perlmeditation: print w/replies, xml ) Need Help??

I'm sure that this has been discussed before...probably ad nausium. But Perl never ceases to amaze me.

I was just reading a post in "Seekers of Wisdom" and one post contained a segment of code and the poster asked "do you think this will work?" An astute responders said, simply, "Try it...then come back if you need help with why it works the way you want or doesn't."

That reminded me of one of Perl's truly great features...in my humble opinion. Perl's ability to "just try it" is amazing. I have programmed on and off for over 30 years...in Basic, Fortran, Cobol, Ada, and even some pretty obscure languages that only a mother could love. Perl, however, has captured my soul.

That capture by, and joy of, Perl is for many reasons; certainly most of them far outshadow the "just try it" feature. But that little feature is probably my most used feature and, every day, astounds me. It is so pervasive in my programming now, with Perl, that I think I'd have to say it is a near-religious experience every time I realize how much I have come to believe in, trust, and benefit from it.

ack Albuquerque, NM
  • Comment on Musing on Perl's "Just Try It" Amazingness

Replies are listed 'Best First'.
Re: Musing on Perl's "Just Try It" Amazingness
by grinder (Bishop) on Dec 12, 2007 at 20:47 UTC

    I've been working for most of the year with a guy who's pretty smart, but has had the misfortune of writing mainly in PHP up until now.

    So we've written a lot of Perl code this year, and it's been a lot of fun as I show him all sorts of different nifty idioms, like initialising a hash slice with an empty array to autovivify hundreds of keys in one statement.

    We often pair-program, and when I'm at the keyboard and I write something unusual, he just starts to laugh and say "no! don't tell me you can actually do that!"

    The thing is, even if he has never seen the particular construct before, he can usually figure out what it is going to do, like an lvalue substr. It's been a lot of fun, certainly on the teaching end.

    • another intruder with the mooring in the heart of the Perl

Re: Musing on Perl's "Just Try It" Amazingness
by meraxes (Friar) on Dec 13, 2007 at 04:39 UTC

    I hated Perl.

    HATED it.

    Here I was, a University student toiling away at my summer job. I'd started programming in higschool in Turing, moved onto Turbo Pascal and VB. In Uni I'd moved onto C and the monolith that is Java.

    Then I had to run these "Perl" scripts for this job. I thought it was ugly and horrid and the first Perl I saw had been written by an executive who had been an English major of all things (they were elegant, long and devoid of logic).

    Then, while clutching my borrowed and dog-eared Camel book, I tried something; a minor to fix a recurring problem that resulted in hours of painstaking data examination.

    Hey. That worked. I just saved hours of work.

    I tried another.

    Hey... that worked too.

    I tried more and more things and had instant feedback and I realized, "Hey, I could do that Java AVL Tree project from last term in fraction of the time."

    So I continued on the path of "just try it". I've tried it in other languages but I return to my love of Perl each time.

    And so when asked about this weird Perl thing by friends who did ASP or PHP or ColdFusion, I told them to give it a whirl. While I haven't converted many, all have been stunned at the instant feedback you can get by just doing it.

    I'm embarrassed by those first programs... but I still love to try.

    --
    meraxes
Re: Musing on Perl's "Just Try It" Amazingness
by ajt (Prior) on Dec 12, 2007 at 20:38 UTC

    A few years ago at a London Perl Workshop, one speaker's talk was titled "J. F. D. I.", he gave two very simple examples of code he wrote.

    In the second example he created a simple screen-scrape module that collected live train running times, so he new if his train to work was on time. Next he used Perl to adjust his alarm clock on the fly, which was simply a Perl application controlling a PC playing MP3/Ogg files. If there was significant disruption, it then emailed his boss to say he was working from home and awoke him appropriately later.

    For a beginners talk I was impressed, you can get a long way in Perl with CPAN as your friend...


    --
    ajt
Re: Musing on Perl's "Just Try It" Amazingness
by webfiend (Vicar) on Dec 12, 2007 at 18:33 UTC

    Perl is awesome, but it's not the only language with TIAS goodness. The principle applies to Ruby and Python as well, and probably many other languages. Perl was the first one I encountered with a community that actively encouraged exploration and adventure, though. It's still a fundamental part of the culture, if the size of CPAN is any indication.

Re: Musing on Perl's "Just Try It" Amazingness
by GrandFather (Saint) on Dec 12, 2007 at 22:43 UTC

    What continues to surprise me is how often (compared with other languages that I use regularly) Perl code I write works first time. This is even more surprising considering that Perl often looks more like line noise at first glance than well structured, intuitive and obvious code!


    Perl is environmentally friendly - it saves trees

      Perl often looks more like line noise at first glance than well structured

      So does every language, foreign, or not.
      To a foreigner it would look *like* a language, but an incomprehensible one.

      This is probably my second least favourite reference to Perl, right after "scripting language".

      Software speaks in tongues of man; I debug, therefore I code.

        I should really (as I considered doing) have changed my sig back to "Perl is Huffman encoded by design" for that post.

        Line noise is generally considered random (although if needn't be). Conventionally written languages of any sort generally present some form of structure. It may be incomprehensible to the reader, but it looks like it does have meaning or at least a pattern.

        Perl on the other hand, especially in the small snippets you might find in one liners, can look almost like a random bunch of characters (line noise). That is more a function of Perl's succinct power than anything else.


        Perl is environmentally friendly - it saves trees
      "The devil is in the details."
Re: Musing on Perl's "Just Try It" Amazingness
by Mutant (Priest) on Dec 13, 2007 at 09:09 UTC

    Maybe not exactly what you're talking about, but being able to easily try something in a one liner, or a small script is something I use all the time. I learnt to program by typing random lines of code into the BASIC shell on my Amstrad CPC 464, running them, and seeing what it did. I learnt Perl in a similar way.

    I still use one liners in Perl to figure out things like this (altho not as often, and usually relating to a specific module I haven't used before). Other languages make this sort of thing much harder. PHP requires you to have some sort of web server to try something (altho I think there's a CLI these days). Don't even get me started on Java.

    So for me, I think this is definitely one of the reasons I ended up a Perl programmer.

Re: Musing on Perl's "Just Try It" Amazingness
by sundialsvc4 (Abbot) on Dec 13, 2007 at 16:26 UTC

    I've also noticed that immediacy is something that is very important in any language. From time to time you just need to “bang out a program quickly,” and very often that requirement will involve some kind of text-processing. This is precisely the sort of thing that Perl was designed to do.

    Most of the things that we do are not computation-intensive:   they invariably require us to locate, parse through, construct, and emit text. “The tool for the job” that we're going to find ourselves picking up time and time again, is one that makes this sort of thing very easy.

    Finally, I think it's significant that this language was a product of one person's need. He needed to do stuff, didn't quite have the language he wanted, and possessed the skills needed to “hack” one. (And I mean that term as an accolade.) The best tools in a workman's toolchest are affectionally known as “kinks,” and Perl is a pretty good kink. Certainly it's well-oiled and well-used.

Re: Musing on Perl's "Just Try It" Amazingness
by dynamo (Chaplain) on Dec 12, 2007 at 22:45 UTC
    If what you say is true, $1 == your soul.

    Sorry, I couldn't resist :)

Re: Musing on Perl's "Just Try It" Amazingness
by Cop (Initiate) on Dec 18, 2007 at 05:39 UTC

    Enlighten me, which language forbids you from trying it?

      None. But none that I've tried make it 'easy'...except Perl. Note: I haven't tried Ruby, PHP...so I'm not saying that Perl is the *only* one...just the only one I've worked with.
      DarkLord1 Looking for Redemption in the Monastery

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 16:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found