Now that you know what $| is,
I suggest you don't use it.
Instead of your global LOGFILE file handle and:
select(LOGFILE); $| = 1;
it is preferable to use a lexical file handle
say) for your log file and then simply:
With recent Perls (5.8+), there's no need anymore to confusingly change the (global) default destination
for print statements via the one-argument form of select -- for
more details, see Perl Best Practices, chapter 10 and
Perl tip: Buffering and IO::Handle
(for Perl 5.14+ you
don't need use IO::Handle).