in reply to Can't open file using Perl as CGI

If open has an error, you need to check for that explicitly.

open INFILE, '<', 'textfile.txt' or print "Error: Can't read textfile.txt: $!";

Normally that "print" would be a "die," but that would only show in your error log, not in your browser.

My guess is that your CGI is not running in the directory you think it is. Try using a full path to the file you want to open. In any case, showing the error will help a lot.