Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uakari.primate.wisc.edu!sdd.hp.com!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: Detab function Message-ID: <10502@jpl-devvax.JPL.NASA.GOV> Date: 21 Nov 90 18:21:08 GMT References: <1990Nov20.182049.12017@uvaarpa.Virginia.EDU> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 20 In article <1990Nov20.182049.12017@uvaarpa.Virginia.EDU> worley@compass.uucp writes: : However, the apparently equivalent program : : perl -pe '$spacing = 8; s/\t/" " x ($spacing - length($`) % $spacing)/eg;' : : doesn't work, apparently because s///g doesn't work exactly as I : expect. I expect it to perform each search and replacement, and then : start searching again in the modified string. It appears (if I insert : a strategic print) that the successive searches are done in the : original string, and all modifications are in a copy of it. (Is this : what we really want? Is this documented?) I don't know if it's what you want, but it's what you get. :-) It's documented in The Book, somewhere... The substitution code is a bit touchy, and if I fiddle with it much I'll end up rewriting it, which I don't want to do right now. Larry