I just spent three frustrating, heartbreaking, suicidal hours catching this bug. I was getting to the point that I started doubting my understanding of the most basic perl.
my @run = MyClass->find_all(); if(@rum){ # do something, }else{ #do something else }
The problem was that the "if" test always fail where it shouldn't. And I caught the bug after I put "print Dumper(@run)" after the first line, in other words, I was willing to accept that may be "if(@rum)" isn't what I think it is after all!

Of course, the bug was that I wrote "if(@rum)" instead of "if(@run)" (and my emacs font/coloring made it barely distinguishable). Why didn't I use strict? because I always use strict, I tell everyone to use strict, I've used strict all my life, and somehow I didn't this time, and I thought I was using strict!

I read some recent post here to the effect that "you don't have to use strict if you know what you're doing", I couldn't disagree more. I'd say, use strict, check twice you're using strict, and ask someone else to check you're using strict. You will live longer if you do.


In reply to That damn "strict" by johnnywang

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.