Just one word: side effects. (No, that's two words. Whatever. :))

If your expression contains parts with side effects (changes of "global" variables, reading input from the outside world), then it may depend on execution order. Actually, it only will, if you do read from it more than once. So,

(scalar <FH>, scalar <FH>)
depends on execution order, as does
($i++, $i++)
while
(scalar <FH>, $i++)
or
($i++, $k++)
do not.

Expressions with no side effects don't ever depend on execution order. That's one of the basic ideas behind functional programming.

update: It's not always obvious to see when a statement has side effects. Two examples I just recently thought of are rand and the operators .. and ..., which all have a built-in variable holding their current state.


In reply to Re^15: Why is the execution order of subexpressions undefined? by bart
in thread Why is the execution order of subexpressions undefined? by BrowserUk

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.