DB<1> sub tst {return undef} DB<2> if ($a=tst()) {print "TRUE"} else {print "FALSE" } FALSE DB<3> if (@a=tst()) {print "TRUE"} else {print "FALSE" } TRUE DB<4> sub tst { return (); } DB<5> if ($a=tst()) {print "TRUE"} else {print "FALSE" } FALSE DB<6> if (@a=tst()) {print "TRUE"} else {print "FALSE" } FALSE #### DB<9> use constant FAILED => (); DB<10> use constant FALSE => !1; DB<11> use constant TRUE => 1; DB<12> sub t_FALSE { return FALSE; } DB<13> sub t_TRUE { return TRUE; } DB<14> sub t_FAILED { return FAILED; } DB<15> if (@a=t_FAILED) {print "TRUE"} else {print "FALSE" } FALSE DB<16> if (@a=t_FALSE) {print "TRUE"} else {print "FALSE" } TRUE DB<17> if ($a=t_FALSE) {print "TRUE"} else {print "FALSE" } FALSE DB<18> if ($a=t_FAILED) {print "TRUE"} else {print "FALSE" } FALSE #### Negation of a true value by "!" or "not" returns a special false value. When evaluated as a string it is treated as '', but as a number, it is treated as 0. #### DB<27> p !defined (FAILED) 1 DB<28> p defined (FALSE) 1