Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.jpl.nasa.gov (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: Bug with $` in s///; in 4.000,4.003 Message-ID: <1991Apr22.175438.8564@jpl-devvax.jpl.nasa.gov> Date: 22 Apr 91 17:54:38 GMT References: <1991Apr20.193701.17201@uvaarpa.Virginia.EDU> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 25 In article <1991Apr20.193701.17201@uvaarpa.Virginia.EDU> ckclark@athena.mit.edu writes: : A problem occurs when trying to replace tabs with spaces using the : invocation: : : while (<>) { : 1 while s/\t+/' 'x (length($&) * 8 - length($`) % 8)/e; : print; : } : : (taken from the Gospel According to lwall, Chapter 3, pg. 105, footnote 31) : : When I run it in 3.044, it works fine, but when I try it in 4.000 or : 4.003, it acts as if length($`) is 0; i.e., as if $` is not bring set. : : I have not seen anything in the documentation which indictates that this : behavior change is intentional. Am I missing something? No, you're right. There was a bug in 3.044 having to do with recursion if the RHS called the subroutine containing the current substitution. In fixing this, I managed to "unfix" $`. It will be fixed in patch 4. Sorry. My testing organization is either too small, or too large, depending on how you look at it. :-) Larry