I'm nitpicking here, but note that $|++ does not increment $| when it's 1. $| is always 1 (flush) or 0 (buffer).
That means that:
# INCORRECT
sub something {
$|++;
# do something without buffering
$|--;
}
Will turn on buffering even if it was off before calling the subroutine.
Usually that's not really a problem, but if you need to revert autoflush to its previous setting, you have to remember its status yourself:
#CORRECT
sub something {
my $flush = $|++;
# do something without buffering
$| = $flush;
}
|