This won't help not only due to what I said above, but also because $| refers to the currently selected filehandle, so STDOUT by default; it won't do anything for code like OP showed. Even though it won't help here, for completeness, $filehandle->autoflush(1) is one way of controlling it.
Yes. I'm always saddened to see unfortunate old Perl globals, such as $|, still being used today.
For more detail on this topic see: Re: what is the meaning of $| in perl? (Buffering/autoflush/Unicode/UTF-8 References)
In reply to Re^3: When can the character length of a Perl Scalar become an issue?
by eyepopslikeamosquito
in thread When can the character length of a Perl Scalar become an issue?
by misterperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |