my @bar=undef; print "def=",defined(@bar), " l=", $#bar, "\n";' output: def=1 l=0