#my @chars = grep !$seen{$_}++, $text =~ /./g; my @chars = 'a'..'z'; my ($re) = map qr/$_/, join '|', map "(?<=${_}{3})$_+", map quotemeta, @chars; $text =~ s/$re//g;