I'm looking at a 5.8.8 man page for perlsyn, and I wonder what you mean by saying that there is "no discussion or comment" about if (EXPR) BLOCK elsif (EXPR) BLOCK ... else BLOCK -- what's wrong with this:

Note that, unlike C and Pascal, these are defined in terms of BLOCKs, not statements. This means that the curly brackets are required−−no dangling statements allowed. If you want to write conditionals without curly brackets there are several other ways to do it. The following all do the same thing: ...

The "if" statement is straightforward. Because BLOCKs are always bounded by curly brackets, there is never any ambiguity about which "if" an "else" goes with. If you use "unless" in place of "if", the sense of the test is reversed.

What more do you think needs to be said (apart from stating the obvious)?

Maybe it's a bit "off the beaten track" for this information to be in a section titled "Compound Statements", which begins with a definition of a BLOCK that is based on "scope", and an overview of what establishes a BLOCK. But it seems appropriate enough in terms of clarifying how conditional statements work in perl.


In reply to Re: Where is if...elsif...else documented in perldoc? by graff
in thread Where is if...elsif...else documented in perldoc? by ELISHEVA

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.