## Arrays

### Definitions

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.

### Syntax

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.

### Example

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?

Examples:

- Subtract a constant number from each measurement (i.e. the
background measurement).
- Calculate the sum of the numbers
- Sort numbers.
- Print numbers.

All these operations act on the entire list.

Table of Contents.

Next.