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*.

Replies are listed 'Best First'.
Re: Re: subroutine within regex quantifier?
by hagen (Friar) on Dec 04, 2001 at 10:26 UTC

    Thanks chromatic, that is clearer and `feels' more Perl-like. I got fixated on having to use the quantifier.

    .

    I also appreciate dws's suggestion re compiling only once.

    Thanks for the prompt responses

    hagen 8-)