Thanks for the explanation. So this is a documented "feature".
I was fooled by believing the general principle that special characters are special unless escaped with a backslash. I would have greatly preferred consistency in this. Are there other known (and perhaps even documented) violations of that principle? I scanned the 5.8 perltrap for "curly" and this was not listed. Who should I notify to request its inclusion? Steve > -----Original Message----- > From: Ronald J Kimball [mailto:[EMAIL PROTECTED] > Sent: Tuesday, January 27, 2004 5:06 PM > To: Tolkin, Steve > Cc: [EMAIL PROTECTED] > Subject: Re: [Boston.pm] using {3-8} instead of {3, 8} > doesn't produce even a warning? > > > On Tue, Jan 27, 2004 at 04:55:28PM -0500, Tolkin, Steve wrote: > > # run using e.g. echo hello | perl this-file > > > > # Why doesn't perl produce a warning from {3-8} ? This seems > > # to be a syntax error. It surely is not the way to match > strings of length > > 3 - 8. It > > # should be {3,8} . > > > > while (<>) { > > if (/[a-z]{3-8}/) { > > print; > > } > > } > > perldoc perlre: > > The following standard quantifiers are recognized: > > * Match 0 or more times > + Match 1 or more times > ? Match 1 or 0 times > {n} Match exactly n times > {n,} Match at least n times > {n,m} Match at least n but not more than m times > > (If a curly bracket occurs in any other context, it is > treated as a > regular character.) > > In other words, in Perl /[a-z]{3-8}/ is equivalent to /[a-z]\{3-8\}/. > > Ronald > _______________________________________________ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm