$|
is a special Perl variable that can only have the values 0 and 1.
Any assignment to $|
of a true non-zero value, like
$| = 1;
$| = 'foo';
$| = "4asdf"; # 0 + "4asdf" is 4
$| = @a;
will have the effect of setting $|
to 1. Any assignment of a false zero value
$| = 0;
$| = "";
$| = undef;
$| = "erk"; # 0 + "erk" is 0
will set $|
to 0.
Expand --$|
to $| = $| - 1
, and now you can see what is going on.
If $|
was originally 1, then --$|
will change the value to 0.
If $|
was originally 0, then --$|
will try to set the value to -1 but will actually set the value to 1.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…