Find size of an array in Perl

The first and third ways are the same: they evaluate an array in scalar context. I would consider this to be the standard way to get an array’s size.

The second way actually returns the last index of the array, which is not (usually) the same as the array size.

Leave a Comment