sysopen (Advanced open)
The sysopen function call gives you greater control over the opening of a file handle. The format of this function call is similar to that of the C open function:
sysopen FILEHANDLE,FILENAME,MODE [, PERMS];
In this case, FILEHANDLE is the file to be opened. The FILENAME is the name of the file to be opened. MODE is open mode. It can be 0 for read, 1 for write, and 2 for read write; however, these values may not work on some operating systems such as Macintosh.
Or you can use the package Fcntl to bring in the symbols O_RDONLY, O_WRONLY, and O_RDWR. This module provides all the flags available on your system. Other flags such as O_APPEND and O_NONBLOCK are available as well.
Finally, if you are creating a file, the PERMS ...
Get Perl for C Programmers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.