What Is an Array?
You've already learned about and used scalar variables in this book, and you know that these variables are used to store values. But scalar variables can store only one value at a time. The $color variable can hold only a value of red or blue, and so forthit cannot be used to hold a list of colors in the rainbow, for example. But arrays are special types of variables that enable you to store as many values as you want.Arrays are indexed, which means that each entry is made up of a key and a value . The key is the index position, beginning with 0. The value is whatever value you associate with that positiona string, an integer, or whatever you want. Think of an array as a filing cabinet and each key/value pair as a file folder. The key is the label written on the top of the folder, and the value is what is inside.