The syswrite keyword[edit | edit source]
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 SCALAR. If OFFSET is positive, OFFSET 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 OFFSET is greater than the string length, only the number of characters that exists are written.
syswrite returns the number of bytes actually written on success, or undef otherwise. For performance reasons, even if the FILEHANDLE has been set to operate on characters, the function tell() will return the byte offsets.
If the FILEHANDLE has been marked as :utf8 Unicode, characters are written instead of bytes, and the return value of syswrite() is in Unicode characters.
Syntax[edit | edit source]
syswrite FILEHANDLE, SCALAR, LENGTH, OFFSET syswrite FILEHANDLE, SCALAR, LENGTH syswrite FILEHANDLE, SCALAR
See also[edit | edit source]