Originally Posted by Wassercrats
I was thinking that the base value that gets masked when using umask in Perl is always 777.
Pretty near every UNIX program that I have seen (or written) all default to using 0666 for files and 0777 for directories. The reason being that setting the execute bit on any file automatically turns it into a script which, by default, would get interpreted by /bin/sh if it was ever executed. This can lead to all kinds of nasty effects.
If you really want to create an executable file, you have three choices:
1. use chmod after creating the file,
2. use sysopen, which is a somewhat more obscure interface, or
3. use fchmod on the open file handle.
I have searched, but haven't figured out how to get fchmod to work in Perl, unfortunately.