Tom Christiansen wrote:
> 
> >Currently, Perl has the concept of C<undef>, which means that a value is
> >not defined. One thing it lacks, however, is the concept of C<null>,
> >which means that a value is known to be unknown or not applicable. These
> >are two separate concepts.
> 
> No, they aren't.

Uhhh, yes, they are...


   undef                     null
   ------------------------  ------------------------
   $a = undef;               $a = null;
   $b = 1;                   $b = 1;
   $c = $a + b;              $c = $a + $b;

   $c is 1                   $c is null

The keyword C<null> means that a value is B<known to be unknown>. This
means a couple important things, with semantics far different from
C<undef>:

   1. Any math or string operation between a null and
      non-null value results in null

   2. No null value is equal to any other null, unlike
      undef

   3. A null value is neither defined nor undefined

To recap: There is no 1:1 mapping between C<undef> and <null>. Any
attempt to do so is inaccurate. For more details, please read the
references.


...


=head1 REFERENCES

http://www.sitelite.nl/mysql/manual_Problems.html#IDX666

http://www.unb.ca/web/transpo/mynet/mtx19.htm#r2

Reply via email to