in reply to Perl and common subexpressions
One minor quibble: the decision not to do common subexpression elimination actually predated tie and references. The main motivation for not doing it was that it was potentially an expensive optimization, and as a compile-and-go language, Perl could not afford any expensive optimizations that don't usually buy you much and can easily
be emulated by hand coding anyway. Of course, as Perl moves more in the direction of precompiled modules, this policy will be subject to revision. (And this is also one of the reasons Perl 6 tightens up the rules on tying so that you can't tie a variable unless it has been declared as tieable, or even tied directly at declaration time.)