in reply to CGI file writing

Are you sure it even exists? You don't check the success of the open call. It could be you're writing into void space.

Otherwise, I'd expect it to be next to the script itself. That usually is a place where you're not allowed to create files by script. If you create the logfile by hand, and set its permissions to writable by anybody, you should be able to write to it.

But in general, like jeffa wrote, the function cwd() from the module Cwd (I think it's a core module) should be able to tell you where the file is supposed to appear.