in reply to What does $# stand for?

$#array returns the last index in a array. So, one less than the number of elements in a array.
The code above is pretty ugly, and I would replace it by
if (scalar @missing)

other examples:
scalar @array == ($#array + 1) # is always true unless you redefine where the index starts. for my $i (0..$#array) { # loops through the array by index number }

Replies are listed 'Best First'.
Re: Re: What does $# stand for?
by Fletch (Bishop) on Oct 15, 2001 at 00:43 UTC

    Actually the scalar in the first case isn't necessary since boolean context is (more or less) scalar context as is shown with the code below.

    @a = (); print "try 1\n"; print "Has elements\n" if @a; push @a, 1; print "try 2\n"; print "Has elements\n" if @a;