Now that I've thought about it some more, I think the point ikegami is making is that just the fact that a behavior is commonly implemented doesn't mean it is actually specified anywhere. And in this case, the behavior of  if (CONDITION) BLOCK is nowhere specified, so don't rely on it.

As I've mentioned before and as you've noted, the behavior of an if-statement returning the result of evaluating  CONDITION when  CONDITION is false and the if-statement is the final statement executed in a subroutine is familiar and seems quite reasonable; it's not surprising that many, perhaps most, Perl implementations adopt this behavior. Whether this behavior is specified and reliable is another question, one I don't have time to pursue ATM. Other questions occur: what's returned from evaluation of a false  CONDITION in a while-loop that is the last statement executed in a subroutine? (I don't dare think about what's going on with a for-loop!)

Food for thought — and links for more reading.


Give a man a fish:  <%-{-{-{-<


In reply to Re^9: resetting a foreach loop! by AnomalousMonk
in thread resetting a foreach loop! by lunette

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.