http://www.perlmonks.org?node_id=129268


in reply to subroutine within regex quantifier?

There's the experimental (?{...}) construct, but I can't think of a way to use that. Why not use length and a slightly different regex?
while (length($target_letters) != WORD_LENGTH && $target_letters =~ /[^A-Za-z]/) { # prompt }
Seems clearer to me, as well as *possible*.