How do I get the total items in an array, NOT the last id?
None of two ways I found to do this works:
my @a;
# Add some elements (no consecutive ids)
$a[
@people = qw( bob john linda );
$n = @people; # the number 3
Print " le number in the list is $n \n";
Expressions in Perl always return the appropriate value for their context. For example, how about the “name” * of an array. In a list context, it gives the list of elements. But in a scalar context, it returns the number of elements in the array: