Well, that entirely depends on how you use foreach and while to iterate over the array. If you do something like: foreach ($a = @a; $a --;) {local $a = shift(@a); ...}, the array is being destroyed. But if you do $a = 0; while ($a < @a) {...; $a++}, the array isn't destroyed.