Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- coding style and performance
August 18, 2005, 6:18 pm
rate this thread
Re: coding style and performance
It does not create a new _variable_ it creates a new _value_
for the variable.
What is local is not the variable (ie. its name), but the variable's value.
No, there is one (lexical) variable (named $element) that has a local()
value in it for a time.
First its value is undef.
Then foreach saves that value is a "secret place", and replaces it
with values taken from @array until the loop is done.
Then the (undef) value is restored to $element.
They are *the same* variable.
Your own _values_ will not conflict with loop's values. :-)
"Coping with Scoping":
Tad McClellan SGML consulting
email@example.com Perl programming
Fort Worth, Texas