[% setvar title Undef values ne value %]
|Note: these documents may be out of date. Do not use as reference!|
To see what is currently happening visit http://www.perl6.org/
Undef values ne value
Maintainer: Richard Proctor <email@example.com> Date: 4 Sep 2000 Mailing List: firstname.lastname@example.org Number: 192 Version: 1 Status: Developing
If you compare a variable that is undefined with something, perl winges. An undefined value is not equal to a string, it should do the right thing.
Perl winges if you compare an undefined value. This is silly and one often has to test for the undefined case (and the empty case for == and !=), then the equality that the programs logic calls for. If you leave warnings off perl does the right thing anyway.
$foo = undef; if ($foo == 1) # should fail the test but not complain if ($foo != 1) # should pass the test, and not complain if ($foo eq "bar") # should fail the test but not complain if ($foo ne "bar") # should pass the test, and not complain
lt,<,le,<=,gt,>,ge,>= should behave as now, as it is resonable to object in these cases as the inequality is not well founded.
A comparison between two undefs should (probably) remain an error.