while( 4096 < length $buffer ) { syswrite( STDOUT, $buffer, 4096 ); substr( $buffer, 0, 4096, '' ); } syswrite( STDOUT, $buffer );