programming-examples/perl/File/The chmod function modifies the read, write, and execute permissions on a file.pl
2019-11-15 12:59:38 +01:00

27 lines
883 B
Perl

The chmod command takes the following parameters:
chmod($mode, $filename);
You can pass more than one file name.
The $mode value is a numeric value based on UNIX file permissions
The $mode value is usually specified in octal notation.
To mark a file as read-only, you can use the following command:
chmod(0444, $filename);
UNIX File Permissions is listed in the following table.
Value Meaning
0400 Owner of file has read permission.
0200 Owner has write permission.
0100 Owner has execute permission.
0040 All users in same group have read permission.
0020 Group users have write permission.
0010 Group users have execute permission.
0004 All users have read permission.
0002 All users have write permission.
0001 All users have execute permission.
The leading zero means these values are octal.