in reply to Finding the total number of elements in an array.
You can get the index of the last element of the array by:
$#arrayname
Which can be used like this:
my $i; for ($i = 0; $i <= $#arrayname; $i++) { #do something }
And getting the total number of elements is as easy as:
my @stooges = qw(Larry Moe Curly); print scalar(@stooges), " Stooges!\n";
J. J. Horner Linux, Perl, Apache, Stronghold, Unix jhorner@knoxlug.org http://www.knoxlug.org/
|
|---|