in reply to CGI, write to file

Typically, a CGI script is run as the webserver user and has very limited permissions so it cannot write to files.

You need to check the return value of that open(), and go from there. Check the error log for the message

open( TMP, ">textfile" ) or print STDERR "[$0] Could not open file! $!";
--
brian d foy <bdfoy@cpan.org>