Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!usc!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: s///e bizarreness Message-ID: <10911@jpl-devvax.JPL.NASA.GOV> Date: 4 Jan 91 18:11:38 GMT References: <1991Jan3.043016.27394@uvaarpa.Virginia.EDU> <1991Jan03.123139.13432@convex.com> <1991Jan3.232855.7457@NCoast.ORG> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 28 In article <1991Jan3.232855.7457@NCoast.ORG> allbery@ncoast.ORG (Brandon S. Allbery KB8JRR) writes: : As quoted from <1991Jan03.123139.13432@convex.com> by tchrist@convex.COM (Tom Christiansen): : +--------------- : | The really unexpected thing here is that /ee yields a double eval. : +--------------- : : You can say *that* again! I just about fell out of my chair when I saw the : "/ee" and its result. You think YOU were surprised! I just about broke my jaw on the keyboard. Looking at the code, however, it's easy to see how it happened. The routine collects the pattern and the replacement, and then processes the options. The replacement is ordinarily stored as syntax-tree node that evaluates a double-quoted string. When it sees the e option, it just forces the double quoting to single quoting and wraps an eval syntax-tree node around the replacement string node. Since there was no code to check for multiple e options, it just wraps another eval node around the replacement every time it sees an e. I think it's a new feature. Don't tell anyone it was an accident. :-) Hmm. I wonder if the ii option should make it twice as case insensitive... Larry Wall lwall@jpl-devvax.jpl.nasa.gov