Hi

I am a little confused with this program

Program:
use strict;
use warnings;

if ($999 == 1056)
{
    print ("\nequal");
}
else
{
    print ("\nnot equal");
}

What I expect: Perl to throw me an error as $999 variable is not defined, but 
perl executes the code with a warning.(I don't expect the code to compile at 
all)

Output:
Use of uninitialized value in numeric eq (==) at wrong1.pl line 4.

not equal


However, if I replace $999 with $num (which is not defined or initialized), I 
get the following error

Global symbol "$num" requires explicit package name at wrong1.pl line 4.
Execution of wrong1.pl aborted due to compilation errors.

What is happening with the top program?

Thanks in advance
sn

Reply via email to