The terminology you are looking for is multidimensional array. I.e you have
an array wherin each element is an array (actually a reference to an
anonymous array IIRC), not a scalar.

You can find the size of the array by asking for it in a scalar context, not
a list context.

For example

my @array = qw(one two three four);
my $arraysize = @array;

print "Array is $arraysize elements in length";

for a multidiemensional array

my @array = (["one", "two", "three"], ["four", "five", "six", "seven"]);

my $arraysize = @{$array[0]};
#               Here you are dereferencing the array referenced by $array[0]
into an anonymous array which is the enclosing @{}, then taking the scalar
value of it which gives you the number of elements in the second level of
the array

print "First sub array size is $arraysize elements\n";

my $arraysize = @{$array[1]};

print "Second sub array size is $arraysize elements\n";

HTH

John

-----Original Message-----
From: Agustin Rivera [mailto:[EMAIL PROTECTED]]
Sent: 18 February 2002 17:18
To: [EMAIL PROTECTED]
Subject: Size of Array


Thank-you to everyone who answered my last question.  As usually I am very
grateful for this group and the people in it.

Quick one.. is there a way to evaluate the size of an array?  Right now I'm
writing the arrays to a file and then doing an "ls -l" to compare sizes. The
array is of type $array[0][0] and not $array[0] (if anyone has the proper
terminology on this, I'd appreciate it).

Thanks,
Agustin Rivera
Webmaster, Pollstar.com
http://www.pollstar.com





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


--------------------------Confidentiality--------------------------.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



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

Reply via email to