http://www.perlmonks.org?node_id=643338


in reply to Puzzling $| behavior

For starters, $|-- is special and may confuse the issue. $|-- toggles $| between 0 and 1. (No idea why)

Secondly, it's bad to modify and use a variable in the same expression because

print "first=", $var, " second=", $var--, "\n";

is basically equivalent to

do { local @_; alias $_[0] = "first="; alias $_[1] = $var; alias $_[2] = " second="; my $anon = $var--; # <-- Changes $var *and* $_[1] alias $_[3] = $anon; # since $_[1] is an alias alias $_[4] = "\n"; # for $var. &print; };