On Thu, 28 Jun 2001, Tyler Longren wrote:
> One more quick question. How can I count the values in an array
> (@servernames)?
> I want to print my servernames seperately:
my $server_count = @servernames;
An array used in a scalar context returns the number of elements in the
array.
or you could do
foreach my $i (0..$#servernames) {
print "$servernames[$i]\n";
}
$#array returns the index of the last element, which is usually the number
of elements - 1.
-- Brett
http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
"I'm not stupid, I'm not expendable, and I'M NOT GOING!"