Ingo Blechschmidt wrote:
am I correct in the assumption that the following is an error? # Not in a BEGIN block my $::(calc_varname()) = 42;
The more interesting question is: how do you expect to adress the var in the code that follows? I guess the compiler won't have a problem with taking $::(calc_varname()) as a variable name. The name doesn't appear anywhere outside the scope anyway. But you should also not expect any &calc_varname beeing called at runtime. And at most once during compile time.
I think so, as my() is a compile-time operation, but in this example, the variable name is not known until runtime, so I think this should be forbidden. Correct?
Well, &my has got a runtime counterpart which creates a fresh set of local variables everytime the code object is invoked. -- TSa (Thomas Sandlaß)