in reply to Printing to a file not working

If open fails, the system error is stored in $!. You should return that error message and check your logfiles.

open my $handle, '>', $file or die "$file: open failed: $!"; print $handle "text\n" or die "$file: print faield: $!"; close $handle or die "$file: close failed: $!";

If you haven't access to the server's logfiles, try using

use CGI::Carp qw(fatalsToBrowser);

That should send fatal error messages to the browser.

Did you already check the permissions? Has the webserver permissions to create/overwrite that file?

update: reformatted code