in reply to Finding a partial match

If I have understood correctly; you are generating random strings of 5 characters, and you want to detect if any of the bad words you have in an array is contained within these random strings.

Here is a little script that does something to that effect:

use feature 'state'; my @bad_words = qw< poop p0op po0p p00p kill k1ll boink bo1nk b0ink b01nk form shut test kiss urge lack sigh find long wear tend nod try fit face care jump feel show hide slip lay wash tie move give omit sum use pay work rule hear fine view mind fund bury stir hunt vary play eat die time bend owe tap meet see nip penis pain >; while(1) { my $string = random_string(); my @matches = grep { -1 < index "\L$string", $_ } @bad_words; print "$string is bad (@matches)\n" if @matches; } sub random_string { state @allowed = ('a'..'z', 'A'..'Z', 0..9); my $string = ''; $string.= $allowed[int rand @allowed] while( 5 > length $string ); return $string; }