A scalar variable contains a scalar value: one number or one string. A string might contain many words, but Perl regards it as one unit.

An array variable contains a list of scalar data: a list of numbers or a list of strings or a mixed list of numbers and strings. The order of elements in the list matters.


Array variable names start with an @ sign.

You may use in the same program a variable named $var and another variable named @var, and they will mean two different, unrelated things.


Assume we have a list of numbers which were obtained as a result of some measurement. We can store this list in an array variable as the following:

@measurement = (3, 2, 5, 9, 7, 13, 16);

What operations would we like to do on this list?

All these operations act on the entire list.

Table of Contents.