# 1. octal number chmod 0644, $file; # 2. decimal number chmod 420, $file; # 3. number in a scalar $mode = 0644; chmod $mode, $file; # 4. number in a scalar (from decimal) $mode = 420; chmod $mode, $file; # 5. number with bitmasks $mode = 0666 & ~022; # like umask chmod $mode, $file; # 6. decimal with bitmasks $mode = 438 & ~022; # 438 == 0666 chmod $mode, $file;