develooper Front page | perl.perl5.porters | Postings from August 2010

Re: RFC: New regex modifier flags

Thread Previous | Thread Next
H.Merijn Brand
August 6, 2010 06:04
Re: RFC: New regex modifier flags
Message ID:
On Fri, 6 Aug 2010 08:14:02 -0400, David Golden <>

> On Fri, Aug 6, 2010 at 7:36 AM, karl williamson <> wrote:
> > I did an analysis of this, and it turns out that the only ambiguous case is
> > 's/foo/bar/le'.  It seems like overkill for this to invent a new temporary
> > pragma, and forbid all the new modifiers as suffixes, when there is no
> > ambiguity at all outside of substitutions, and no ambiguity  using
> > substitutions except for one  combination out of all those possible.  Why
> > can't we just say in the pods and warning message that '/le'  must be
> > written as '/el' in 5.14?
> Help me understand what you mean by ambiguous. If there is really only
> one case, then great!
> But hypothetically, what would s/foo/bar/elt1 do?  Would the "l" parse
> as a modifier or would it parse as bar of "lt"?
> Here's a stupid, but legal example:
>   $ perl -wE '$_=<>; sub bar { "bar" }; if ( s/foo/bar/elt 1 ) { say
> "not done" }'

And mind you that some module might add those flags dynamically. I know
abigail does some funky stuff, but I bet others do to. Then an eval of
code with a generated regex where the l got inserted just before the e
will suddenly fail.

FWIW I have no strong opinions here, just pointing to possible places
of hurt.

H.Merijn Brand      Perl Monger
using 5.00307 through 5.12 and porting perl5.13.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, OpenSuSE 10.3, 11.0, and 11.1, AIX 5.2 and 5.3. 

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