[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: offtopic: perl question about dialog.pl



On Sun, 24 Oct 1999, Eric G . Miller wrote:

> For a count of elements in an array
> 
> $count = $#array;
           ^^^^^^^^^
this is the subscript of the last element in array, one less than
the length, since there is a 0th element;

$count++;  # number of elements in array @array;

you could also do:

$count = scalar(@array);

[]s,
Mario O.de Menezes            "Many are the plans in a man's heart, but
    IPEN-CNEN/SP                 is the Lord's purpose that prevails"
http://curiango.ipen.br/~mario                 Prov. 19.21
                   http://www.revistalinux.com.br


Reply to: