Charles K. Clarkson wrote:

Aaron C. de Bruyn <mailto:[EMAIL PROTECTED]> wrote:

: In the Perl documentation (perlintro) it says that you can find out
: the number of elements in an array using the following syntax:
: : print $myvar[$#mmyvar];


   No. That prints the value of the last element of @myvar. The number
items in the array is the scalar evaluation of @myvar.

print scalar @myvar;



I beg your pardon, but why $myvar[$#mmyvar] is the first element of array?

For example:

@myvar = qw(a b c d e f g);

and as I can understend, $#myvar is 7, but the last element has index 6.


HTH,

Charles K. Clarkson




--
Vladimir D Belousov


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to