#! /usr/bin/perl use strict; use warnings; my @array = qw/1 2 3 4 5 6 7/; print "number of elements is " . ++$#array . "\n";
The increment is necessary because the first element is @array[0].
This produces:
ww@GIG:~/pl_test$ perl elementsinarray.pl number of elements is 7
In reply to Re: Printing the length of an array ?
by ww
in thread Printing the length of an array ?
by jflevi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |