> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, October 24, 2001 4:56 AM > To: [EMAIL PROTECTED] > Subject: Problem in require function with strict > > > Here the situation: > > I am doing a perl program to do some exams and quiz to the > employees in my job. Supose the name of the program is exam.pl > and I want to store the hash in onother file called > hash_store.pl with a hash called "%RESPUESTAS", so I can change > the test more easy (the question and answer) with a control > pannel that create a hash when the teacher hit submit. The > problem is here, because I use stric in the main program when I > use the "require hash_store.pl" at the top of the program and > then run it, Perl give me this error: > > ======== > The specified CGI application misbehaved by not returning a > complete set of HTTP headers. The headers it did return are: > > > Global symbol "%RESPUESTAS" requires explicit package name at > E:\Inetpub\Medifast\scripts\test\prueba.pl line 72. > Global symbol "% > ======== > > I try all the push to @INC and the sub BEGIN{} and the > function "use" and always Perl give me same massege. When I try > this without strict its run fine.
The problem is not with how you are using require; it's with the rules of 'use strict'. 'use strict' requires you to either declare variables with 'my', 'our', or 'use vars' or to qualify the variable with a package name. Assuming you intend %RESPUESTAS to be a global hash, you need to add our %RESPUESTAS; to the top of both your main script and your require'd file (assuming both have 'use strict'). See: perldoc strict perldoc -f our -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]