On Mon, May 09, 2005 at 09:47:14AM -0600, Paul Seamons wrote:
> > =item *
> >
> > Quantifiers (except C<?> and C<??>) cause a matched subrule or subpattern to
> > return an array of C<Match> objects, instead of just a single object.
> What is the effect of the quantifiers C<**{0,1}> and C<**{0,1}?> ?  Will they 
> behave like ? and ?? and return a single object - or will they cause the 
> quantified subrule or subpattern to return as an array of C<Match> objects?

First, I much prefer an alternate wording to Damian's:

   The C<*>, C<+>, and C<**{...}> quantifiers all produce an array
   of C<Match> objects instead of just a single object.

To answer your question, C<**{0..1}> always produces an array of 
Match objects (think C<**{$m..$n}> where $m and $n may not be 
immediately known),  while C<?> always produces a single Match object.

Both C<**{0..1}> and C<?> will match "zero or one occurrence" of the
thing being quantified, but a non-matching C<**{0..1}> results in
a zero-length array, while a non-matching C<?> results in an 
"unsuccessful" Match object.


Reply via email to