Running:
produces:use Data::Dumper; $x[0]=[0];map{undef $_}(@x);print "still defined\n" if defined @x; print Dumper(\@x);
I trust that clarifies what is going on. That is, your array contains a single element with the value undef. Note that an array containing a single element with an undef value is not undef, not even false in scalar context. To be false in scalar context, the array needs to be empty.defined(@array) is deprecated at undef1.pl line 2. (Maybe you should just omit the defined()?) still defined $VAR1 = [ undef ];
Oh, and please heed the deprecated warning and replace "if defined @x" with simply "if @x" (see defined for why).
In reply to Re: map and undef - odd behaviour with an array of arrays
by eyepopslikeamosquito
in thread map and undef - odd behaviour with an array of arrays
by Melly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |