http://qs1969.pair.com?node_id=29457


in reply to Removing certain elements from an array

My solution (clumsy as usual):
my @array = qw( ...); my @remindexes = qw( ... ); my %remindexes; my @newarray; for (@remindexes) { $remindexes{$_}++; } for (my $i = 0; $i <= $#array; $i++) { push @newarray, $array[$i] if !$remindexes{$i}; }
Of course, if you would setup the indexes to remove into a hash from the beginning, you could omit the first step.