I have a curious problem with open:
It runs fine on command line:#!/usr/bin/perl $^W=1; use CGI; $| = 1; print "Content-type: text/html\n"; print "Hello, World!\n"; open ($in, "<", "source.list") or die "can't open file: $!"; @src_name = grep /^[A-B]/, <$in>; close $in; print $src_name[0]; print $src_name[$#argument];
But if I run it as a cgi script, ie. pointing my browser to http://lapakahi/csodb/test2.pl, it fails to open the file source.list:#./test2.pl Content-type: text/html Hello, World! A02008P2350 BSW30905
I made sure the file source.list is in the same directory as the script test2.pl, and it is readable by all. Also tried using absolute path for the file. Same result.Server error! The server encountered an internal error and was unable to complete yo +ur request. Error message: can't open file: No such file or directory at /srv/www/csodb/test2.pl +line 7. , If you think this is a server error, please contact the webmaster. Error 500 lapakahi Thu Oct 28 10:24:57 2010 Apache/2.2.0 (SuSE)
Any suggestions and advices will be greatly appreciated.
In reply to curious problem with open by hihilo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |