The output is buffered and you didn't wait long enough. (4096b / 25b/msg * 5s/msg ≤ 164s)
Buffering can be turned off:
use strict; use warnings; use IO::Handle qw( ); my $log = "/tmp/log.txt"; open my $LOG, ">", $log or die "$!\n"; $LOG->autoflush(1); while ( 1 ) { my $time = localtime() ; print $LOG "$time\n"; print "$time\n"; } close $LOG;
In reply to Re: problem writing to a file handle
by ikegami
in thread problem writing to a file handle
by natxo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |