You have to convert the value to octal representation, e.g.
my $perm = 33092;
printf "%o\n", $perm & 07777; # prints 504
Also, to set the permissions, you probably want $attrs->perm( 0777 ),
not $attrs->perm( [ '0777' ] ). The square brackets in the docs mean optional,
i.e. you'd specify nothing to retrieve the value (combined 'setter' and 'getter' method...).
Update: forgot to mention the '& 07777' above masks off the four octal groups of
interest here, i.e. three times rwx (for user/group/other), plus the
SUID/SGID/sticky octal group (the latter is the first (leftmost) one). |