sub remove_poly { my ($array,$lim) = @_; grep { my $max_num = int($lim * length())-1; !/(.)(?:.*?\1){$max_num}/ } @$array; }