develooper Front page | perl.perl6.language | Postings from April 2006

S5 - Question about repetition qualifier

Thread Next
Joe Gottman
April 25, 2006 18:57
S5 - Question about repetition qualifier
Message ID:
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.


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.


Joe Gottman

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About