[% setvar title Undef values ne value %]

This file is part of the Perl 6 Archive

Note: these documents may be out of date. Do not use as reference!

To see what is currently happening visit http://www.perl6.org/

TITLE

Undef values ne value

VERSION

  Maintainer: Richard Proctor <richard@waveney.org>
  Date: 4 Sep 2000
  Mailing List: perl6-language@perl.org
  Number: 192
  Version: 1
  Status: Developing

ABSTRACT

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.

DESCRIPTION

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.

Thus:

  $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.

IMPLENTATION

No idea

REFERENCES

None yet