![]() |
|
P is for Practical | |
PerlMonks |
Re: Answer: How do I completely remove an element from an array?by choroba (Cardinal) |
on Feb 17, 2014 at 18:20 UTC ( [id://1075198]=note: print w/replies, xml ) | Need Help?? |
I would probably not declare $arrayElement in the broad scope, but instead use a lexical loop variable in each loop:
The broad scope has no advantage, as the variable is localized anyway: If the variable is preceded with the keyword "my", then it is lexically scoped, and is therefore visible only within the loop. Otherwise, the variable is implicitly local to the loop and regains its former value upon exiting the loop. If the variable was previously declared with "my", it uses that variable instead of the global one, but it's still localized to the loop. This implicit localization occurs only in a "foreach" loop. (From perlsyn)
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
In Section
Seekers of Perl Wisdom
|
|