in reply to
What's wrong with this local() ?
Based on the question, I think you were expecting the localized version to be initialized to the external value. I ran a quick test under Perl v5.8.5, and found that
local $A::variable = $A::variable;
gives the desired behavior. It's nice, but it doesn't have to be that way, because this behavior implies that the "local" was executed after the RHS of the assignment was evaluated.
Having said that, I don't think that precidence relationship is clearly defined in the language, and you probably shouldn't trust it for production code. Unless someone older and wiser than I knows for sure that it was planned that way?
|
Comment on
Re: What's wrong with this local() ?
Download Code | |
|---|---|
| Re^2: What's wrong with this local() ? by Anonymous Monk on Jan 31, 2008 at 17:52 UTC | |
by ikegami (Pope) on Jan 31, 2008 at 18:37 UTC | |
| Re^2: What's wrong with this local() ? by ikegami (Pope) on Jan 31, 2008 at 18:02 UTC |