use Data::Dumper;
$x[0]=[0];map{undef $_}(@x);print "still defined\n" if defined @x;
print Dumper(\@x);
produces:
defined(@array) is deprecated at undef1.pl line 2.
(Maybe you should just omit the defined()?)
still defined
$VAR1 = [
undef
];
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.
Oh, and please heed the deprecated warning and replace "if defined @x" with simply "if @x" (see defined for why).
|