Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!rutgers!mcnc!uvaarpa!mmdf From: worley@compass.com (Dale Worley) Newsgroups: comp.lang.perl Subject: Re: Changing the first character of a string. Message-ID: <1990Jul3.144552.5407@uvaarpa.Virginia.EDU> Date: 3 Jul 90 14:45:52 GMT Sender: mmdf@uvaarpa.Virginia.EDU (Uvaarpa Mail System) Reply-To: worley@compass.com Organization: The Internet Lines: 21 From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) $flags =~ s/^[^\0]?/U/; Hmmm... Why is NUL treated specially? Also, this illustrates one thing I don't like about regexps -- people write code which depends on the order in which the alternatives are matched. For instance, in the regexp above, the case where [^\0]? matches the null string can always match, so it implicitly depends on the fact that the non-null match is tried first. On the other hand, it's hard (impossible?) to write a regexp which matches in only the right way without some way to specify context for the match (shades of \: and \;!!!). Dale Worley Compass, Inc. worley@compass.com -- They are actually planning to produce object oriented COBOL. If it comes out, it will undoubtedly be called "ADD 1 TO COBOL". -- Cay Horstmann