in reply to creating a file with a cgi script

As someone commented before- this is a cgi, right? So.. it's being run by a http trigger, so.. it's run by apache.. Unless you have suexec running, if you look at the process, it would be running under wwwrun, or some other 'user' . Even though the script may be owned by you.

So, when you ask for $ENV{HOME} (if it is set) or ~, you are asking for the home of some other user. Likely.

If yuo're on a *ix box, you're lucky or smart; so why don't you try this.. print STDERR $ENV{HOME};

Then in your shell prompt, do this ..  tail -f /var/log/httpd/error_log - that will let you see STDERR as you go (leave that window runninng, and as you try out your script, the window will output your cgi STDERR). *your* exact apache error log may be somewhere else, like /var/log/apache2/error_log .

That will help debugging