我正在开发一个已经发布的perl代码的新版本,并找到了一行:
$|++;
AFAIK,$|与管道有关,如in this link所述,我明白这一点,但我不知道(plus plus)是什么意思.
先谢谢你.
编辑:找到答案in this link:
简而言之:它强制在下一个语句之前打印(刷新)到控制台,以防脚本太快.
Sometimes,if you put a print statement inside of a loop that runs really really quickly,you won’t see the output of your print statement until the program terminates. sometimes,you don’t even see the output at all. the solution to this problem is to “flush” the output buffer after each print statement; this can be performed in perl with the following command:
$|++;
[update]
as has been pointed out by r. schwartz,i’ve misspoken; the above command causes print to flush the buffer preceding the next output.