Today, I just discovered a nasty habit of mine: guessing at code and syntax. I use the word "discovered" because I carried it out on a subconscious level. As I think about it now, it's been the source of countless frustrating hours trying to figure out why my code doesn't work the way I think it should. I want to share this because it's probably safe to say that I'm not the only who has this vice.

By "guessing at code" I mean writing code you only think is right without looking it up to make 100% sure. Out of pride, we convince ourselves that we know Perl and don't need any damn book to tell us how to code. What makes this habit particularly insidious is that by the time you've written and executed a whole block of code, you forget the parts you guessed at and start assuming that it's correct. This can lead you on a wild goose chase that could have been avoided if you just double checked your code against a reference work. So, if you have the least doubt about how to carry something out, look it up!

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop";
$nysus = $PM . $MCF;
Click here if you love Perl Monks


In reply to Never guess at code! by nysus

Title:
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, details, 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, summary, 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.