Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Perl's $| setting affect system commands?

Tags:

perl

buffering

I am looking at some old code in Perl, where the author has writtern $| = 1 in the first line.

But the code does not have any print statements, it calls a C++ binary using the system command. Now I read that $| will force flush after every print. So does it affect the system command's output in any way or am I safe to remove that line.

Thanks Arvind

like image 784
Arvind Avatar asked Dec 03 '22 15:12

Arvind


1 Answers

I do not believe so. The $| will affect the way that Perl is running, not any external executable.

You should be safe to remove it.

perldoc - perlvar : States "If set to nonzero, forces a flush right away and after every write or print on the currently selected output channel.". I think the important thing here is the "currently selected output channel". The external application will have it's own output channel.

like image 162
Xetius Avatar answered Dec 23 '22 17:12

Xetius