ЭЛЕКТРОННАЯ БИБЛИОТЕКА КОАПП |
Сборники Художественной, Технической, Справочной, Английской, Нормативной, Исторической, и др. литературы. |
3.2.12 chmodchmod This function changes the permissions of a list of files. The first element of the list must be the numerical mode, as in chmod(2). (When using nonliteral mode data, you may need to convert an octal string to a decimal number using the oct function.) The function returns the number of files successfully changed. For example: $cnt = chmod 0755, 'file1', 'file2'; will set chmod 0755, @executables; If you need to know which files didn't allow the change, use something like this: @cannot = grep {not chmod 0755, $_} 'file1', 'file2', 'file3'; die "$0: could not chmod @cannot\n" if @cannot; This idiom makes use of the grep function to select only those elements of the list for which the chmod function failed. |