use IO::Handle; # ... $fh->autoflush();