use IO::Handle; ... open LOG ... LOG->autoflush(); # or flush manually as needed: ... LOG->flush();