References to Various Perl Datatypes

References are pointers. A reference variable stores an address. In this way you can store a pointer to a huge chunk of data and later dereference the pointer to get at the data.

What Is a Reference?

You can think of a Perl reference as a scalar whose value is the address in memory of where a piece of data is stored. The piece of data may be a simple value, such as a string, or it might be more complex, such as a record consisting of a name, an occupation, and a series of elements relating to the occupation. In Perl, a reference is a scalar variable that contains the address of some arbitrarily complex piece of data.

Scalar References

One way to create a reference is by using the \ symbol. You can think of ...

Get Programming PERL in the .NET Environment now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.