umask 0777; umask 511; # same, with decimal notation - but slightly confusing my $u = 0777; $u &= $other_number; umask $u; # also works