in reply to mkdir with variable mask

You don't have to pass a string to umask that represents an octal number - anything that's stored as a number, or can be converted to a number, is fine.
umask 0777; umask 511; # same, with decimal notation - but slightly confusing my $u = 0777; $u &= $other_number; umask $u; # also works