This is confusing me. I had a function that returned an array of answers if it found one or more answers, else it returned undef. On return, the result was assigned to an array and I tested the array for being defined or not.my @bar=undef; print "def=",defined(@bar), " l=", $#bar, "\n";' output: def=1 l=0
I thought that if my function returned undef and that was assigned to an array, the array should also test as not defined. Buuuut....noooooOOOOoooo.... :-(
Why does my array, assigned "undef", then tell me it is defined? :-(... Very sad. I thought undef was the opposite of defined (sort of). I mean "undef" is a value (or an "unvalue"?), and defined is a test to see if a 'value' doesn't evaluate to 'undef', no? I'm sure there's a good reason for this, but at this point it sure doesn't seem "intuitive"...Arrg....
(this is what I get for doing whatever it is that I've done to deserve this! :-))....
In reply to undef==defined sometimes? by perl-diddler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |