I'm writing a Perl script that generates a Bash script. I'm using open() with a mode of > to output everything to a new file. Standard stuff:
open (FILEOUT, ">", "rename.sh") or die "Can't create rename.sh";
The resultant .sh file is read only, with an octal value of 444. In perldoc it says I can add a + to the > (open (FILEOUT, "+>", "rename.sh")) to make the newly created file readable and writable, or 666.
Is there a way to make the new file executable (755 or anything else) using open()? If not, what's the best way to set file permissions for the new file?