The cgi script folder is normally not writeable to by the web server for security. Try adding
use CGI::Carp 'fatalsToBrowser'; # use only while debugging
to your script to see what is causing the internal error
or try this SSCCE which writes to /tmp
#!/usr/bin/perl
use strict;
use warnings;
use CGI qw/:standard/;
use CGI::Carp 'fatalsToBrowser'; # use only while debugging
use Cwd;
my $cwd = getcwd(); # current working directory
my $event = param('event') || 1;
my $newCOMMENT = param('newCOMMENT') || 'test comment';
my $commentUID = time();
my $path = '/tmp';
my $fileA = "$path/$event.txt";
my $fileB = "$path/$commentUID.txt";
if ($newCOMMENT ne "") {
open AFH, '>>', $fileA
or die "Could not open $fileA : $!";
print AFH "$commentUID\n";
close AFH;
open BFH, '>>', $fileB
or die "Could not open $fileB : $!";
print BFH "$newCOMMENT\n";
close BFH ;
}
print header,start_html;
print pre("
cwd : $cwd
event : [$event]
newCOMMENT : [$newCOMMENT]
commentUID : $commentUID");
print end_html;
poj