my %unique; @unique{@arrayindex} = (); foreach my $i (sort { $b <=> $a } keys %unique) { splice @array, $i, 1; }