my %u; splice @array, $_, 1 for grep !$u{$_}++, sort { $b <=> $a } @indices;