On Tue, Apr 25, 2006 at 09:57:58PM -0400, Joe Gottman wrote:
> According to Synopsis 5, the repetition qualifier is now **{.} where the .
> must correspond to either an Int or a Range.  This seems rather restrictive.
> Why are we not allowed a junction of Ints, for instance 
> 
>             m/^ a**{1|3|5} $/ ; # Match 1,3, or 5 a's.

        m/^ a**{1..5:by(2)} $/;         # Match 1, 3 or 5 a

> This does not seem noticeably more difficult than a range.  
> 
> Also, I don't know exactly what the syntax looks like, but I can imagine
> using a repetition qualifier that takes a closure of some sort, for instance
> to match an odd number of repetitions
> 
> m/^ a**{($_ % 2 == 0)} $/; #I'm not sure about the syntax for the code.

        m/^ a**{1..*:by(2)} $/;         # match an odd number of a

:-)

I get your point though.  There's no easy way to say "match 1, 7, 12, or
19" with this particular syntax.  

How often does that come up in practice though?  I don't think I've
ever wanted something like that.

If we allow "Junction of Int" that also gets us "Set of Int" as
Junctions are just funny Sets. Why not "Array of Int" too?

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to