Changes the permissions of a list of files. The first element of the list must be the numerical mode, which should probably be an octal number, and which definitely shouldnot a string of octal digits:0644 is okay,'0644' is not. Returns the number of files successfully changed. See also"oct", if all you have is a string.
$cnt = chmod 0755, 'foo', 'bar';chmod 0755, @executables;$mode = '0644'; chmod $mode, 'foo'; # !!! sets mode to # --w----r-T$mode = '0644'; chmod oct($mode), 'foo'; # this is better$mode = 0644; chmod $mode, 'foo'; # this is bestYou can also import the symbolicS_I* constants from the Fcntl module:
use Fcntl ':mode';chmod S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH, @executables;# This is identical to the chmod 0755 of the above example.Perldoc Browser is maintained by Dan Book (DBOOK). Please contact him via theGitHub issue tracker oremail regarding any issues with the site itself, search, or rendering of documentation.
The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via thePerl issue tracker, themailing list, orIRC to report any issues with the contents or format of the documentation.