Output the number of elements and the last index number : Array Output « Array « Perl






Output the number of elements and the last index number

   


@array = qw( zero one two three four five six seven eight nine );


print "There are ", scalar( @array ), " elements in \@array.\n";
print "The last index in \@array is $#array.\n\n";

   
    
    
  








Related examples in the same category

1.Output the whole array in print
2.Months Of The Year
3.A program that prints every element of an array.
4.Print each value in the array.
5.Output nested array
6.Output all elements in an array with print command
7.Output the last element in the array
8.print "@{[uc(hello)]} there.\n";