Mở các tập tin ở cấp độ hệ thống được xử lý bởi sysopen. Điều này, như mở cửa, có một tên filehandle và tên tập tin như một tham số. Không giống như mở, sysopen không phải mất một chuỗi chế độ như + | Input and Output with Filehandles Simpo PDF Merge and Split Unregistered Version - http Opening Filehandles at the System Level Opening files at the system level is handled by sysopen. This like open takes a filehandle name and a filename as an argument. Unlike open sysopen does not take a mode string like or but a numeric mode made up of several mode flags whose values specify the desired attributes of the filehandle. The Fcntl module defines labels for these numeric flags such as O_WRONLY for write-only access or O_CREAT to create the file if it does not exist. The mode cannot be combined with the filename as it is with open instead it comes after the filename as an additional third parameter use Fcntl import standard symbols sysopen SYSHANDLE filename O_WrONLY O_CREAT The standard open modes can all be expressed in terms of a sysopen mode value is equivalent to O_RDONLY and is equivalent to O_WRONLY O_CREAT O_TRUNC. The following two statements are actually identical but phrased differently open a file write-only with open open HANDLE filename open a file write-only with sysopen sysopen HANDLE filename O_WRONLY O_CREAT O_TRUNC Note that sysopen does not create a different sort of filehandle from open. In particular it does not create an unbuffered handle. Whether or not the filehandle is buffered or unbuffered depends on how we read and write with it. Functions like read getc and the readline operator work via the standard IO buffers while functions like sysread and syswrite bypass them. sysopen itself has no opinion on the use of buffers or not - it merely provides a lower-level way to create filehandles. For the curious coming from a C background while it is true that sysopen uses the open system call to generate an unbuffered file descriptor it then uses fdopen to create a filehandle from that file descriptor and returns this to Perl. So sysopen does create a filehandle even though it does not use the fopen system call. For many applications