in reply to (crazyinsomniac) Re: Order of output when switching filehandles
in thread Order of output when switching filehandles

Erk. That seems to have fixed it. Thanks.

Just out of curiosity, can any of you gurus explain why that happens?

  • Comment on RE: Re: Order of output when switching filehandles

Replies are listed 'Best First'.
RE: RE: Re: Order of output when switching filehandles
by isotope (Deacon) on Aug 14, 2000 at 23:04 UTC
    I may be smoking something, but usually $| = 1; doesn't completely disable buffering, just most of Perl's buffering. You still need to close it to force the OS buffer to be flushed.
      As I understand it, when $| = 0, then buffering is enabled, and I think how it works depends on whether you are outputting to a terminal. $| = 1 doesn't completely disable buffering but turns on 'command buffering', so each time you do a 'print' or whatever, everything from that command is printed asap.