in reply to Re: Remove array elements dynamically! (reverse)
in thread Remove array elements dynamically!
assuming of course that the indexes are sorted in ascending order. Safer is:
foreach my $i (sort {$b <=> $a} @arrayindex) { splice @array, $i, 1; }
which sorts in descending order thus guaranteeing the indexes are sorted, and removing the need for the reverse.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Remove array elements dynamically! (reverse)
by lodin (Hermit) on Aug 27, 2007 at 23:11 UTC | |
by GrandFather (Saint) on Aug 27, 2007 at 23:20 UTC |