10. References

Perl allows one to refer to the location of a certain variable in memory. An
expression that holds such a location is called a reference. Those that
are familiar with C's or Pascal's pointers may think of references as
pointers. There are however, two fundamental differences:

There is no reference arithmetics in perl. If for example, a reference points
to the fifth element of an array, then adding 1 to it will not refer you to the
sixth element. In fact, adding or subtracting integers from references is
possible but quite meaningless.

A reference is guaranteed to remain the same even if an array or a string are
resized. In C, reallocing an array yields a completely different
pointer.

Perl distinguishes between an array or a hash and a reference of it.
The reference of any array may be taken, and a reference to an array
may always be converted to its elements, but there is still a difference
in functionality.

The best way to change a variable in a different scope
(such as inside a different function) is to pass its reference to the
function. The called function can then dereference the variable to access
or modify its value.