Documentation for routine temp
Documentation for routine temp, assembled from the following types:
sub prefix:<temp>(Mu is rw)
"temporizes" the variable passed as the argument. The variable begins with the same value as it had in the outer scope, but can be assigned new values in this scope. Upon exiting the scope, the variable will be restored to its original value.
my = "three";say ; # OUTPUT: «three␤»say ; # OUTPUT: «three␤»
Note that you can also assign immediately as part of the call to temp:
temp = "five";
temp restores the old value of a variable at the end of its scope. However,
temp does not create a new variable.
my = 0; # temp will "entangle" the global variable with the call stack# that keeps the calls at the bottom in order.sub f(*);sub g(*);print g(g(f(g()), g(), f()));# OUTPUT: «<g># <g># <f># <g># </g># </f># <g># </g># <f># </f># </g># </g>␤»