next up previous contents
Next: Literal Arrays Up: Arrays Previous: Arrays

What is an Array?

Perl uses arrays-or lists-to store a series of items. You could use an array to hold all of the lines in a file, to help sort a list of addresses, or to store a variety of items. We'll look at some simple arrays in this section.

An array, in Perl, is an ordered list of scalar data.

Each element of an array is an separate scalar variable with a independent scalar value -- unlike PASCAL or C.

Arrays can therefore have mixed elements, for example

(1,"fred", 3.5)

is perfectly valid.