in reply to can't get chmod to work

umask may be the source of your pain.

The default permissions of a newly created file are set by umask. If your user process has a different umask than your script process, you may have troubles.

I wish I could provide a good summery of how umask interacts with parent directory permissions and the many places it can be set, but I don't think I could do a shorter or more accurate job than the man pages or a more knowledgeable monk.

I reached my current incomplete understanding of umask through the following commands.

man umask grep -d recurse -i umask /etc | more more <files that seem relevant> man <files that seem relevant>
...and searched my ftp server's docs to realize that umask needed to be set in my ftp server's config file.

Your problem is obviously not ftp related so perhaps:
 perldoc -f umask might help. You might also toss a debugging  system('ls -l'); into your script just after you create your $new file.

Hope this helps (or is at least relevant...)



--mandog