Perl Programming/Keywords/chmod

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Previous: CHECK Keywords Next: chomp

The chmod keyword[edit | edit source]

chmod changes the permissions of a LIST of files. The first LIST element must be numeric and should be an octal number, like 0755 chmod returns the number of files successfully changed.

If the operating system supports fchmod(2), a FILEHANDLE can also be part of the list. If this is not the case, an exception is raised.

Syntax[edit | edit source]

  chmod LIST

Examples[edit | edit source]

chmod 0751 Boeing
Changes the access permission of file Boeing to read-write-execute for the user, to read-execute for the group of the user, and execute-only for the rest of users.

Previous: CHECK Keywords Next: chomp