Well, technically, yes, you missed the demise of local
, but only because we renamed it to temp
and made it completely orthogonal to storage class declarations. You can temporize any variable, and it will restore itself at the end of the current lexical scope. You can also conditionally temporize a variable using let
, and it resets at the block end only if the block fails. But these are operations on existing variables.
Even in Perl 5, local
never declares a variable,
but merely temporarily changes the value of an existing global.
And to reiterate, state variables are not globals. They're persistent lexicals. You can temporize them, but then you can temporize my variables as well. You can even temporize attribute accessors and not worry about whether the accessor represents a real attribute or is a wrapper around something else:
temp $handle.autoflush = 1;