[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] bad file handle



On Tue, 19 Mar 1996, Jeffrey Dawkins wrote:

> I've been working through the examples in Eric Herrmann's book "Teach 
> yourself cgi programming with perl in a week" (a wonderfully informative 
> book btw) and I seem to be having problems with Listing 5.11 a script for 
> comparing data from a database with the cgi form input.  I've loaded it 
> onto my unix server and I keep getting this error message when I try to 
> run it from the command line:
> 
> "bad symbol for filehandle" line 5
> the code is the call to open the database.
> 
> #!/usr/local/bin/perl
> push(@INC, "/cgi-bin");
> require("cgi-lib.pl");
> &ReadParse(*input);
> open($PRICE_FILE, "../sys2.txt");
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> while (<$PRICE_FILE>) {
> chop;
> ($item, $price) = split(/:/,$_,2) ;
> }
> 
> I wondering why I can't seem to open the database. I've set permissions 
> on the db file to 766 so it should be readable to the httpd. 
> 
> If anyone knows this program and has tried to run  it or if you see the 
> problem please let me know. Thank you

You probably want to use PRICE_FILE instead of $PRICE FILE.  The former 
is a file handle indentifier; the latter is a scalar variable (which in 
this case would have to contain a file handle identifier).

BTW, what has this to do with MacPerl?

John Peterson -- University Networking Services -- Brigham Young University
Internet: John_Peterson@byu.edu                       Phone: (801) 378-5007