Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: Changing the first character of a string. Message-ID: <8611@jpl-devvax.JPL.NASA.GOV> Date: 5 Jul 90 23:01:12 GMT References: <1990Jul5.135434.11674@uvaarpa.Virginia.EDU> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 20 In article <1990Jul5.135434.11674@uvaarpa.Virginia.EDU> worley@compass.com writes: : : From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) : : You'll have to ask the designers of C that question. Perl isn't treating : it at all specially here--it's just relying on the convention that normal : text never contains it. /[^\0]/ is just an idiom for matching any textual : character including newline, which /./ specifically won't match. : : Sounds like a good way to get screwed if the string actually contains : a NUL. Why not "(.|\n)"? It's not likely to contain a NUL in the context we were originally talking about, in which the programmer will probably have initialized the string to spaces. Then again, it's unlikely to contain a newline for the same reason. And (.|\n) is considerably slower, at least the way things are currently set up. It wouldn't be if we were using a DFA. But we aren't. Larry