Just because there are a lot of mundane situations that can lead to problems, doesn't mean that you in particular have recently run into any of them, of course.

But my point was that a lot of average Perl coders who decide to copy the "not length" usage can easily end up introducing bugs in several different quite mundane ways. And that pointing this out might encourage some to do the research to figure out why or, if already aware, to just be reminded to take care.

'or' and (to a lesser extent) 'not' and 'and' were designed for use as flow control and work well for that (at least for those who don't mind such idioms). You can certainly bend them to the purpose of simple boolean expressions, but the required bending is somewhat subtle, is not needed in many situations, and can often lead to errors that are only triggered in relatively rare "edge cases". I find this makes the risk unacceptably high of real bugs making it all of the way into Production if one starts frequently using 'not' for boolean expressions.

And when I got around to looking, I quickly found that my suspicions were confirmed and more than once, even for code from our best Perl coder. So I'm less shy about pointing this out, now.

Clearly, you are much better than any of our Perl coders. But a few people read this web site despite only being better than some of our Perl coders. q-:

- tye        


In reply to Re^6: Undefined vs empty string (so much not) by tye
in thread Undefined vs empty string by Anonymous Monk

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.