$retMode & 0777means that you take the value of the return mode (which is the file resolution + file type) and Bitwise-And its using the octal number of 777 (for example, decimal number 511, for example binary 111111111).
What does this mean technically - removes any bits from an integer above the 9th bit, so if the binary representation of the mode was> 9 bits, after this operation it would leave only the last 9 bits, representing the main permissions (read / write / execute for others / group / user).
? ( perldoc stat, mode() stat:
" , , printf, " % o ", ".
, 9- , 9 , . , 12 ( & 07777), 10-12 , // // perms (, setuid, is_directory).
$retMode & 006 , . 006 110 , 2/3 . , , # , , 1.
, & 006 - BAD-, , perms ( , , 2/3 ). (S_IF *) (S_IS *) Fcntl:
use Fcntl ':mode';
$retMode = $retMode & 0777;
$other_read_or_write = $retMode & (S_IWOTH || S_IROTH);
if ($other_read_or_write) {
printf "$property|%03o|$fpath\n",$retMode;
}