[thelist] Count array locations in perl

Marty Landman marty at face2interface.com
Wed Feb 14 05:30:05 CST 2001

At 06:19 PM 2/13/01, you wrote:
>Does anyone know of a perl function that returns the number of array 

If you mean the size of an array, you get the index of the last element by 
accessing the array in scalar context with an '#' just in front of the name.

Of course since Perl starts loading an array at elmt 0 you'd want to add 
one to get the size.

Here's the input and result from a run I just did on a server:

perl -e '
print "size a eq $#a";
==>>  size a eq 4


More information about the thelist mailing list