Now I've returned home and I uploaded the same script and the same text file to my website's server. Now when I run the script it fails with an error:
Error opening produce_items.txt! : No such file or directory at /html/cgi/eproduce.cgi line 24.
First of all, here's the code I'm using:
#===== Open the file containing our list of produce $filename = "produce_items.txt"; open(PRODUCE, $filename) || die "Error opening $filename! : $!\n ";
Someone suggested trying the full pathname, so I amended the code as follows:
#===== Open the file containing our list of produce $current_directory = $ENV{PWD}; $filename = "$current_directory" . "/" . "produce_items.txt"; open(PRODUCE, $filename) || die "Error opening $filename! : $!\n ";
This fails with the same error (well, slightly different... it says "/produce_items.txt" instead of "produce_items.txt").
The text file is in the same directory as the cgi file, by the way.
I know this is a CGI problem, not a Perl problem, but perhaps someone more experienced than I can see what I'm doing wrong?
Many thanks!
In reply to Slightly OT: Perl and CGI - reading a file by C_T
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |