in reply to Re: How do I completely remove an element from an array?
in thread How do I completely remove an element from an array?

I would probably not declare $arrayElement in the broad scope, but instead use a lexical loop variable in each loop:
for my $arrayElement (@a) { ... }

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)

لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ