use IO::Handle; open my $fh, ">", "test.out" or die $!; $fh->autoflush(); print $fh "..."; # is being written immediately