my %h; @h{ 0 .. $#array }++; delete @h{@remindexes}; @array = @array[ sort { $a <=> $b } keys %h ];