use String::Random; $foo = new String::Random; # e.g. AqF8, YcE2, BjW8 ... $string = $foo->randpattern("CcCn");