use IO::Handle; STDOUT->autoflush(1); open my $fh, '>', 'asd.txt' or die $!; $fh->autoflush(1);