use IO::Handle qw( ); open LOG, '>', 'log.txt' or die $!; LOG->autoflush(1);