in reply to What's the idiom for finding and removing the found @ARRAY element?
The point being that each time you delete an element, the indices of all elements after it in the array change.for my $i ( reverse 0 .. $#a ) { splice( @a, $i, 1 ) if should_delete; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: What's the idiom for finding and removing the found @ARRAY element?
by tye (Sage) on Nov 06, 2002 at 16:41 UTC | |
by jdporter (Paladin) on Nov 06, 2002 at 16:53 UTC | |
|
Re: Re: What's the idiom for finding and removing the found @ARRAY element?
by John M. Dlugosz (Monsignor) on Nov 06, 2002 at 04:32 UTC | |
by Aristotle (Chancellor) on Nov 06, 2002 at 12:25 UTC | |
by jdporter (Paladin) on Nov 06, 2002 at 14:11 UTC | |
|
Re: Re: What's the idiom for finding and removing the found @ARRAY element?
by rir (Vicar) on Nov 06, 2002 at 14:49 UTC |