$foo = "NARGLE"; print ref($foo), "\n"; defined(ref($foo)) ? print "Y\n" : print "N\n"; ref($foo) == undef() ? print "Y\n" : print "N\n";
The print ref() obviously prints nothing but a newline. However, I was quite surprised when the two trinary statements both printed "Y". I went back to the documentation and looked up both defined() and undef(). Defined "Returns a boolean value telling whether EXPR has a value other than the undefined value 'undef'...". Looking over at the undef docs, it "always returns the undefined value". How is it possible for ref($foo) to be both defined and == undef?
~Cybercosis
nemo accipere quod non merere
In reply to Undefined undef oddness by Cybercosis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |