use strict; use warnings; $|++; # make buffer 1 (error happens with or without this) open LOG,">foo.log" or die "can't open foo.log: $!"; while (1) { print LOG (localtime).": something\n"; sleep(30); # if I comment this, print works }