Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!ncoast!allbery From: allbery@NCoast.ORG (Brandon S. Allbery KB8JRR) Newsgroups: comp.lang.perl Subject: Re: s///e bizarreness Message-ID: <1991Jan3.232855.7457@NCoast.ORG> Date: 3 Jan 91 23:28:55 GMT References: <1991Jan3.043016.27394@uvaarpa.Virginia.EDU> <1991Jan03.123139.13432@convex.com> Reply-To: allbery@ncoast.ORG (Brandon S. Allbery KB8JRR) Followup-To: comp.lang.perl Organization: North Coast Computer Resources (ncoast) Lines: 29 As quoted from <1991Jan03.123139.13432@convex.com> by tchrist@convex.COM (Tom Christiansen): +--------------- | From the keyboard of marc@mit.edu: | :% perl -e '$_="|2+2|";s/\|([^\|]*)\|/$1/e;print "$_\n";' | :2+2 | :% perl -e '$_="|2+2|";s/\|([^\|]*)\|/$1/ee;print "$_\n";' | :4 | | The reason case 2 says what it does is that $1 as an expression is just | "2+2". On the other hand , "3+$1" does yield 7, not 3+2+2, so maybe just | maybe it really is a buglet, as I don't quite see why $1 shouldn't be 4 +--------------- It must be a bug --- otherwise, you would *need* to use /e to get $1, ... to expand on the RHS. Which is not and has never been the case. +--------------- | 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. ++Brandon -- Me: Brandon S. Allbery VHF/UHF: KB8JRR on 220, 2m, 440 Internet: allbery@NCoast.ORG Packet: KB8JRR @ WA8BXN America OnLine: KB8JRR AMPR: KB8JRR.AmPR.ORG [44.70.4.88] uunet!usenet.ins.cwru.edu!ncoast!allbery Delphi: ALLBERY