PDA

View Full Version : Perl says 'uninitialized', variable is.


Ido Perelmutter
06-05-2003, 08:22 PM
I got this problem with one of my CGI/Perl programs:
Trying to execute it using the web browser, I get a 500 server error. On the computer, using the perl debugger, I get 3 errors:
1. Use of uninitialized value in string eq at line 33
2. same as above
3. Use of uninitialized value in index at line 33

line 33 is:
if ($screen eq "admin") {

and $screen was initialized in a preceading line:
$screen = $ENV{'QUERY_STRING'};

what can I do?

thanks.

ACJavascript
06-07-2003, 10:07 PM
Well, first is the $screen variable initialized as a global variable?

second, remove the " " (quotes) for admin. Try that.

Ido Perelmutter
06-07-2003, 11:14 PM
Originally posted by ACJavascript
Well, first is the $screen variable initialized as a global variable?

second, remove the " " (quotes) for admin. Try that.

yes, $screen is initialized as global.
and removing the quotes doesn't work. It gives and error.

if you have any other ideas, i will be much obliged to hear.

ACJavascript
06-08-2003, 05:00 PM
Could you post your code here so we can see it fully??

Mabye try placing $screen="$ENV{'HTTP_QUERY_STRING'}";

in quotations Im not sure that will make a difference though..

Question,, is the query being called?
if not then it might be sending you a " nothing " and so its not initialized.

Ido Perelmutter
06-11-2003, 12:41 PM
I don't know. Nothing works.
I guess I'll just have to rewrite the program.

Thanks for trying to help though.

ACJavascript
06-11-2003, 04:22 PM
Could you post your whole script?

Philip M
06-22-2003, 09:50 AM
Change "admin" to 'admin' (single quotes).

Double quotes interpret so PERL is looking for a variable called "admin" which does not exist.

You want to compare with the literal string 'admin'.