in reply to Re: Logical expression evaluation
in thread Logical expression evaluation

As mentioned earlier in this thread, Perl uses "" for false. It does not use undef.
$i = undef; print(defined($i) ? "[$i]" : 'undef', "\n"); $i = !1; print(defined($i) ? "[$i]" : 'undef', "\n"); __END__ output ------ undef []

Replies are listed 'Best First'.
Re: Logical expression evaluation
by benizi (Hermit) on Jul 27, 2005 at 20:55 UTC
      And nowadays, you can have the magic of dualvars for your own evil plots applications, using dualvar() from Scalar::Util.

      BTW another typical magical dualvar value is $!, which returns an error message as a string, and an error number as a number. For example:

      local $\ = "\n"; $! = 3; # error number print $!; # error message print 0+$!; # error number