Re: Counting the size of an array reference

2001-12-21 Thread Michael R. Wolf
"Tomasi, Chuck" <[EMAIL PROTECTED]> writes: > For a normal array (@MyArray), one can use $#MyArray to > get the position of the last element. "index" is a better term You usually don't need to use that syntax, however. Use @MyArray in a scalar context. $MyLen = @MyArray; o

RE: Counting the size of an array reference

2001-12-20 Thread Gibbs Tanton - tgibbs
$#{ $MyArray } will give you the position of the last element. -Original Message- From: Tomasi, Chuck To: '[EMAIL PROTECTED]' Sent: 12/20/2001 10:01 AM Subject: Counting the size of an array reference For a normal array (@MyArray), one can use $#MyArray to get the position o

RE: Counting the size of an array reference

2001-12-20 Thread Bob Showalter
> -Original Message- > From: Tomasi, Chuck [mailto:[EMAIL PROTECTED]] > Sent: Thursday, December 20, 2001 11:02 AM > To: '[EMAIL PROTECTED]' > Subject: Counting the size of an array reference > > > For a normal array (@MyArray), one can use $#MyArray to

RE: Counting the size of an array reference

2001-12-20 Thread John Edwards
Or, better still sub MySub { my ($aref)=@_; $count = $#{$aref}; return $count; } John -Original Message- From: Tomasi, Chuck [mailto:[EMAIL PROTECTED]] Sent: 20 December 2001 16:02 To: '[EMAIL PROTECTED]' Subject: Counting the size of an array

RE: Counting the size of an array reference

2001-12-20 Thread John Edwards
How about sub MySub { my ($aref)=@_; $count = @{$aref}; return $count - 1; } HTH John -Original Message- From: Tomasi, Chuck [mailto:[EMAIL PROTECTED]] Sent: 20 December 2001 16:02 To: '[EMAIL PROTECTED]' Subject: Counting the size of an array

Counting the size of an array reference

2001-12-20 Thread Tomasi, Chuck
For a normal array (@MyArray), one can use $#MyArray to get the position of the last element. So, if I'm given $MyArrayRef, how does one do the same operation to find out how many things are in MyArrayRef? Ex: sub MySub { my ($aref)=@_; return(__); } my @MyArray = (0,