RE: Number of Items in Array

2005-04-18 Thread Charles K. Clarkson
Vladimir D Belousov wrote: : I mean 'but why $myvar[$#mmyvar] is the last element of : array', not 'first' in my letter. : I thought that $#array is equal scalar(@array). $#array equals 1 less than scalar(@array). scalar(@array) gives the number of elements in @arr

Re: Number of Items in Array

2005-04-18 Thread Vladimir D Belousov
John Doe wrote: Am Montag, 18. April 2005 10.53 schrieb Vladimir D Belousov: Charles K. Clarkson wrote: Aaron C. de Bruyn wrote: : In the Perl documentation (perlintro) it says that you can find out : the number of elements in an array using the following syntax:

Re: Number of Items in Array

2005-04-18 Thread John Doe
Am Montag, 18. April 2005 13.38 schrieb John Doe: [...] > perl -le' > use strict; use warnings; > my @a=(); > my @b=(0); > my @c=(0,1); > print $#a, " / ", $#b, " / ", "\n"; sorry, this should of course be print $#a, " / ", $#b, " / ", $#c, "\n"; (I ran it with the arrays () and (0,1) and ins

Re: Number of Items in Array

2005-04-18 Thread John Doe
Am Montag, 18. April 2005 10.53 schrieb Vladimir D Belousov: > Charles K. Clarkson wrote: > >Aaron C. de Bruyn wrote: > >: In the Perl documentation (perlintro) it says that you can find out > >: the number of elements in an array using the following syntax: > >: > >: pri

RE: Number of Items in Array

2005-04-18 Thread Thomas Bätzler
Vladimir D Belousov <[EMAIL PROTECTED]> asked: > I beg your pardon, but why $myvar[$#mmyvar] is the first > element of array? Because $#mmyvar is 0 - and if you "use warnings;" Perl will tell you that @mmyvar is undeclared. If you use $myvar[$#myvar], it will print the last element. Better yet, u

Re: Number of Items in Array

2005-04-18 Thread Vladimir D Belousov
Charles K. Clarkson wrote: Aaron C. de Bruyn 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 @my

RE: Number of Items in Array

2005-04-18 Thread Charles K. Clarkson
Aaron C. de Bruyn 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