$#{ $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
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, 3, 6, 9, 154);

my $LastElement=&MySub(\@MyArray);

print "The last element is: $LastElement\n";



What goes in ___________?

--Chuck

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to