Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hanging out here at PM is an enjoyable thing, as I'm sure the regulars would agree. Fun, friendly, informative -- what more could you want?

What's better is that it has actually markedly improved my "craft" in employing the oddly-shaped tool we know (and love?) as Perl.

It's also helped me to think more "perlishly" about things. Before hanging out here, I would use perl to solve problems because it was a quick and accessible tool -- but my designs were, to echo meryln's comments elsewhere, too BASIC-like. Now I begin to think about lists and contexts as I prepare algorithms. I also believe I am more prone to consider some of the OW in TIMTOWTDI.

Example: I was browsing through comp.lang.perl.misc recently and saw a cry for how to remove unwanted whitespace. Now, this is a FAQ, but I've come to enjoy using the construction

$_ = join ' ', split;
which came to me a while back (after becoming a monk) because I thought it was cool how the list propagated, and how I had pushed the whitespace worry into perl (i.e. I made split worry about it). So I posted this solution just to share the different perspective. (Note: you need to use $x = join ' ', split ' ', $x; if your string isn't in $_.)

Turns out this is pretty efficient, too -- japhy (in his real world persona) ran and posted some benchmarks that show it is as (or more) efficient than the FAQ solution and faster than some naive regex solutions. That's somewhat beside the point, though -- I had shared my solution because (1) it was a different perspective from the usual approach and (2) there was something "perlish" about it that appealed to me. Perl, and the craft thereof, has been getting under my skin. I lay this at the feet of the Monks here :)

Another example: I recently had to write a checksum checking routine, where the last digit is a checksum digit based on an algorithm applied to the other digits (no surpises there). I used this:

my $check = chop $digits;
to grab the check digit and prepare the remaining string ...a solution that would never have occurred to me a couple of months ago (Monks have me reading the docs, and merlyn's stance on void contexts has had me thinking about return values of late) and would likely have led me to use a couple of less than appealing (to me) substr calls. It's not a huge thing, but aestethically I find it more appealing. Wait a minute -- aesthetically? It's over for me now, I'm afraid :) No longer is it enough to get code working; it has to appeal to me as well.

As a final example, also from my checksum routine just mentioned (which was a very cool problem since you had to think about the whole number both as a string and a number, a very natural thing to do in Perl), a basic part of the checksum routine invloved substituting numbers (10..35) for the letters A-Z before doing anything else. I solved this with

my %x; @x{0..9,'A'..'Z'} = (0..35); my $converted = join '', map {$x{$_}} split //, $digits;
...and what's better is that this was the first solution I thought of. I wrote it, in that haze of concentration you can only get while coding, and afterwards looked at the solution and said -- hey, that's pretty cool!

Well, that was pretty long winded when all I really wanted to convey was that I like it here, and my experience here has broadened my enjoyment of programming.

Thanks, Monks!

In reply to Craftier by snax

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (8)
    As of 2018-01-19 21:53 GMT
    Find Nodes?
      Voting Booth?
      How did you see in the new year?

      Results (223 votes). Check out past polls.