"You are post-incrementing your variable. It isn't 'true' until after the and is evaluated."

I am a little bit concerned that this statement could be easily misunderstood (I strongly believe that you mean the right thing, and I don't intend to second guess, but I want make this a little bit more clear and precise. I know that I am a little bit picky here ;-).

If you try this code:

my $a = 1; $a++ and print $a;

You will get 2, which shows that right after "$a++" is evaluated, and before the entire second line finished, ++ already happened.

From a pure language view, that "It" in your sentence could stand for the phrase "your variable", which appeared earlier. In the case of the original post, that variable is already true before that "and" is evaluated, but it is false before the "++" happened. However "++" happens before "and".


In reply to Re: Re: 'and next' question by pg
in thread 'and next' question by Not_a_Number

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.