in reply to $| pre and post increment and deincrement behavior

If you want $| to be 1, assign 1 to it. Pre- or post indcrement is unnecessarily "clever" and could bite you if $| doesn't happen to have the value you assume.

  • Comment on Re: $| pre and post increment and deincrement behavior

Replies are listed 'Best First'.
Re^2: $| pre and post increment and deincrement behavior
by robin (Chaplain) on Dec 01, 2005 at 14:05 UTC
    Someone seems intent on repeating this particular piece of misinformation, so perhaps it's worth repeating (just this once) that it's incorrect.

    I do agree that $|++ is unnecessarily clever, since it might confuse an ignorant maintenenance programmer, and that $| = 1 is clearer. But it's simply wrong to say that it could “bite you if $| doesn't happen to have the value you assume”. It couldn't, for reasons that will be obvious to anyone who has understood this thread.