Eirik Berg Hanssen wrote:
Leopold Toetsch <[EMAIL PROTECTED]> writes:


Sam Ruby <[EMAIL PROTECTED]> wrote:


I took a look into this.  Apparently, in Perl5, the result of xor'ing
undef with anything is undef.  I'm not suggesting that this is either
right or wrong (it actually was surprising to me),

Yep. It doesn't really follow the definition of xor, nor does it match the implementation of other types.

Which Perl5 (xor, undef) would this be? It does not look like the result is undef around here:

My bad. I misinterpreted an empty string as an undef. Here's the test I ran:


  my $a = undef;

  $c = $a xor $a;
  print "$c";

  $c = $a xor 0;
  print "$c";

  $c = $a xor 1;
  print "$c";

  $c = 2 xor $a;
  print "$c";

  $c = 3 xor 4;
  print "$c";

  $c = 0 xor $a;
  print "$c";

  $c = 5 xor 0;
  print "$c";

  $c = 0 xor 6;
  print "$c";

  print "\n";

perl -v returns:

  This is perl, v5.8.4 built for i386-linux-thread-multi

- Sam Ruby

Reply via email to