in reply to Deleting specific element in array in FOREACH loop
while(@array) { my $element = $array[0]; # do tons of stuff... if($result eq 'foo') { shift @array; } }
is a better approach, since you want to consume the array with your loop.
<update> - reread post - this doesn't fit.</update>
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Deleting specific element in array in FOREACH loop
by graff (Chancellor) on Sep 15, 2006 at 22:18 UTC |