in reply to checking CHMOD on directories

my $mode = 03777 & (stat "/path/to/")[2];

Mode '777' is 511, '755' is 493, sticky 777 (like /tmp) is 705. The modes are commonly cited as octal numbers, as is the mask in the code.

It may be preferable to use -w "/path/to/" or similar as a test of permissions.

After Compline,
Zaxo