Suppose i want to match words with at least 4 letters, (and store them in an array), I have written the following regex, which works fine:
if ( $text ~~ m:g/(\w ** 4..*)/ )
{
my @words = $/;
...
}
The quantifier being from 4 to unlimited
**4..*
Now if I try to substitute 4 with a scalar $min_length. Both:
if ($text ~~ m:g/(\w ** $::min_length..*)/)
and:
if ($text ~~ m:g/(\w ** <$::min_length>..*)/)
results in an error at compilation: Quantifier quantifies nothing
Is there a way for having a scalar as a quantifier?