in reply to Cannot open file for appending

open(PRES, ">>poll_results.txt")
You should probably use an absolute path here or chdir() to where you want to write the file. Although it depends on your web server and configuration, a CGI process generally does not start off with its current directory equal to the directory where the script is found.