For something like this, I usually use a hash rather than an array, so that I can use delete() on the hash element. Maybe something like this (untested):
my %hash; for my $i (0 .. 7) { $hash{$i}++; } foreach (keys %hash) { # do stuff delete($hash{$i}) if ($condition); }
In reply to Re: Deleting specific element in array in FOREACH loop
by ptum
in thread Deleting specific element in array in FOREACH loop
by awohld
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |