$|=1; # $| is undef by default - which means use buffering - define it as 1 - and it instantly writes. print FILE scalar localtime; print FILE " ## Exit\n"; close FILE;