Perl Programming/Keywords/syswrite

The syswrite keyword
The syswrite function tries to write LENGTH number of bytes from the SCALAR to the FILEHANDLE by using write(2) of UNIX. If LENGTH is not specified, the whole string is written.

Without an OFFSET, it writes the whole content of the <tt>SCALAR</tt>. If <tt>OFFSET</tt> is positive, <tt>OFFSET</tt> number of characters are skipped. If it is less than zero, it places the data this number of bytes before the end of the string. If <tt>OFFSET</tt> is greater than the string length, only the number of characters that exists are written.

<tt>syswrite</tt> returns the number of bytes actually written on success, or <tt>undef</tt> otherwise. For performance reasons, even if the <tt>FILEHANDLE</tt> has been set to operate on characters, the function <tt>tell</tt> will return the byte offsets.

Do not use <tt>syswrite</tt> with reads or with <tt>eof</tt>, <tt>print</tt>, <tt>seek</tt>, <tt>tell</tt>, or <tt>write</tt>, as it bypasses normal buffered I/O.

If the <tt>FILEHANDLE</tt> has been marked as <tt>:utf8</tt> Unicode, characters are written instead of bytes, and the return value of <tt>syswrite</tt> is in Unicode characters.