Learn about tied variables in Perl. These allow the programmer to associate an ordinary variable with an (object-oriented) object in such a way
that operations on the variable are automatically interpreted as method invocations on the object. As an example, suppose we write tie $my_var,
"my_class";. The interpreter will create a new object of class my_class,
which it will associate with scalar variable $my_var. For purposes of discussion, call that object O. Now, any attempt to read the value of $my_var
will be interpreted as a call to method O->FETCH(). Similarly, the assignment $my_var = value will be interpreted as a call to O->STORE(value).
Array, hash, and filehandle variables, which support a larger set of built-in
operations, provide access to a larger set of methods when tied.
Compare Perl’s tying mechanism to the operator overloading of C++.
Which features of each language can be conveniently emulated by the other?