
Arrays and hashes are very powerful data structures, but they are limited in their capacity to only hold scalar data at an individual index. An array or hash index can only hold a singular item.
For example, to store the birthday, age, gender, and occupation about a person, keyed to their name, we could create 4 hashes or use a hash-of-hashes as in our previous example using music CDs.
References, while being a scalar, on the other hand can hold lists of data. We can use them to create and use very complex data structures (among other things).
If you have C programming experience, references are similar to pointers - they point to a location where data is stored. But Perl's references are a much better tool.
One of the worrisome things you have to deal with in C is garbage collection and dangling pointers. These are pointers to chunks of memory that are no longer being used - not something you want your program to be doing.
References (memory locations) in Perl are handled by the computer - DUH! No more 'garbage collection' or 'dangling pointers'.
References are created merely by putting a backslash '\' in front of the variable name.
No kidding - \@array or \%hash are references to an array and a hash.
We assign a variable to an array reference as simply as $arrayRef = \@array. Likewise $hashRef = \%hash assigns the variable '$hashRef' to the hash reference.
But references can be taken to almost anything - strings, functions, numbers, arrays, hashes.
By now you've got to be wondering 'What can I do with that?'. I know I certainly was when I first started learning about them.
References