Hi GrandFather,

The reason I added the explanation of $cell or next; to my post was because I first saw the output of B::Deparse, so perhaps the narrative of my post would have been better that way around - "here's what B::Deparse gives you, and here's what it means".

Personally, I find $cell or next; is short enough to be readable in all three variations (next unless $cell;, next if !$cell;), and if I was writing it I'd lean towards next unless $cell;. If either side of the or had been more complex or becomes more complex later, then I might agree with you. As for the general case of if/unless vs. and/or, I write it however I find most readable. For example, sometimes I find $cond or die "some long error message" better than die "some long error message" unless $cond, even if the latter is wrapped on two lines. Or, I've recently found myself writing $DEBUG and print "..." more often, I find it helps me skip over those lines quicker when I'm skimming the code. On the other hand, if the condition is more complex, I'd start considering maintenance costs (usually precedence issues creeping in), and I'd probably switch over to the "safe" if (...) {...}. And it's a matter of TIMTOWTDI and taste too, I guess :-)

Regards,
-- Hauke D

Update: Fixed one of the code samples.


In reply to Re^3: next unless condition by haukex
in thread next unless condition by hankcoder

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.