There are six types of references. A reference can point to a scalar, an array, a hash, a glob, a function, or another reference. Table 8.1 shows how the different types are valued with the assignment operator and how to dereference them using curly braces.
The Six Types of References are:
| Reference Assignment | How to Dereference |
|---|---|
$refScalar = \$scalar; |
${$refScalar} is a scalar value. |
$refArray = \@array; |
@{$refArray} is an array value. |
$refHash = \%hash; |
%{$refHash} is a hash value. |
$refglob = \*file; |
Glob references are beyond the scope of this course |
$refFunction = \&function; |
&{$refFunction} is a function location. |
$refRef = \$refScalar; |
${${$refScalar} is a scalar value. |
Essentially, all you need to do in order to create a reference is to add the backslash to the front of a value or variable.