in reply to Re: Strange Behavior
in thread Strange Behavior

I don't understand why $|++ is universally preferred (or at least so it seems to me) over the more straightforward $|=1. What's the reason?

What bugs me about $|++ is that it implies that there are levels of unbuffering, and that with $|++ we are getting more unbuffering than whatever we had before.

And heaven forbid that some clown earlier on had the cute idea of unbuffering the selected handle with something like $|--. Come to think of it, $|++ seems to me every bit as bad as $|--.

the lowliest monk

Update: Fixed some awkward grammar.

Replies are listed 'Best First'.
Re^3: Strange Behavior
by phaylon (Curate) on Mar 23, 2005 at 12:30 UTC
    Can't speak for others, I use $|++ 'cause it's easier for me to see and find in Sources than $| = 1.

    Ordinary morality is for ordinary people. -- Aleister Crowley
Re^3: Strange Behavior
by QM (Parson) on Mar 28, 2005 at 15:06 UTC
    I don't understand why $|++ is universally preferred (or at least so it seems to me) over the more straightforward $|=1. What's the reason?
    Perhaps your "Perl Sense" is underdeveloped? $var++ can be either a counter or a boolean. It's the context that's important (as with so many things in Perl). I'd wager that most Perlers distinguish between the use of ++ and how the object is used.

    If you feel the need to be explicit, you might like this:

    use IO::Handle; STDOUT->autoflush(1); # OO form autoflush STDOUT 1; # procedural form

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of