This section describes symbolic (or soft) references, replacing variable or function identifiers by string expressions. Curly brackets {} or the dereference operator -> is the best way of using symbolic references.
Symbolic references are scalar objects containing strings representing identifiers
of variables and functions. Symbolic references are also called soft references.
There are several ways to use symbolic references.
1. Directly placing a scalar variable that contains the referencing string in the
place where the identifier should be.
For example, $name = 'foo'; $$name = 10; print "$foo";
2. Placing an expression that returns the referencing string in curly brackets {}
to replace the identifier. Curly brackets are also called lookups. String literals
in lookups don't have to be quoted.
For example, $name = 'foo'; ${$name.'l'} = 20; print "$fool";
3. If a symbolic reference is used to access a single element of an array, to access
a single element of hash, or to call a function, you can remove the name space
prefix character $, or &, and replace the identifier with an expression that
returns the referencing string, then followed by the dereference operator: ->.
For example, $name = 'foo'; $name->[0] = 30; print "$foo[0]";
4. Of course, symbolic references can be nested.
For example, $a = 'b'; $b = 'c'; $c = 40; print "$$$a";
See next sections for more examples on symbolic references.