use IO::Handle '_IOFBF'; my $buf; # set fully buffered, with a buffer size of 1024 bytes STDOUT->setvbuf($buf, _IOFBF, 1024);