Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: Reference: syscallChapter 5
Function Reference
Next: Reference: sysread
 

sysopen

sysopen filehandle, filename, mode, [perms]

Opens the file given by filename and associates it with filehandle. This function calls open(2) with the parameters filename, mode, and perms.

The possible values and flag bits of the mode parameter are system-dependent; they are available via the Fcntl library module. However, for historical reasons, some values are universal: zero means read-only, one means write-only, and two means read/write.

If the file named by filename does not exist, and sysopen creates it (typically because mode includes the O_CREAT flag), then the value of perms specifies the permissions of the newly created file. If perms is omitted, the default value is 0666, which allows read and write for all. This default is reasonable: see umask.

The FileHandle module provides a more object-oriented approach to sysopen. See also open.


Previous: Reference: syscallPerl in a NutshellNext: Reference: sysread
Reference: syscallBook IndexReference: sysread

Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.