Perl operator: $|++; dollar sign pipe plus plus

前端 未结 4 515
春和景丽
春和景丽 2020-12-17 10:24

I\'m working on a new version of an already released code of perl, and found the line:

$|++;

AFAIK, $| is related with pipes, as explained

4条回答
  •  半阙折子戏
    2020-12-17 10:33

    It's an old idiom, from the days before IO::Handle. In modern code this should be written as

    use IO::Handle; STDOUT->autoflush(1);

提交回复
热议问题