References and Data Structures

What are Hard References

A hard reference points to, or refers to, the data stored under some variable name. The data can be a scalar, an array, a hash etc. We may call this data a referent.

Alternatively, a hard reference can point/refer to anonymous data, namely data that does not have a variable name of its own. Such a reference is called an anonymous reference.

In the following pages, whenever we use the term reference, we mean a hard reference.

A reference is itself a scalar. We previously learned that there are two types of scalars, namely numbers and strings. References are a third type of a scalar.

References can be used to build complex data structures, such as two-dimensional arrays, arrays of hashes, hashes of arrays, hashes of hashes, records etc. We will learn about them later.

Note: a given referent may be pointed to by more than one reference.

Table of Contents.