CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
uninitialized help!!!



Mar 14, 2001, 9:32 AM

Post #1 of 2 (481 views)
uninitialized help!!! Can't Post

Hello I have a script that begins with:
#!/usr/bin/perl -w
use strict;

and I get the following warnings...
Use of uninitialized value at ./ line 43.
Use of uninitialized value at ./ line 51.
Use of uninitialized value at ./ line 112.

the respective lines are...
my @Pares = split(/;/, $ENV{'HTTP_COOKIE'});
if ($COOKIE{'LGuser'} eq "" && $FORM{'ProcLoginCheck'} eq "") { &LOGIN; exit; }
print qq|

What is happening here???



Mar 15, 2001, 2:24 AM

Post #2 of 2 (474 views)
Re: uninitialized help!!! [In reply to] Can't Post

Some of your variables have not been initializaed.
For example, 'HTTP_COOKIE' does not exist in the
environment, or LGuser does not exist or is not
defined in the %COOKIE.

Usually it is not a major problem, because Perl
substitutes uninitialized value with 0 in numeric or "" in
string context, though sometimes this may point you to
the variable that was supposed to be initialized and wasn't.
In general, you may use defined($var) instead $var eq "" to avoid this situation.

defined() returns true in case some value has been assigned to the variable, even "" and false otherwise.

Jean Spector
QA Engineer @ Extent Technologies, Ltd.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives