Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: Perl bug (was: Capitalizing words in a line.) Message-ID: <11481@jpl-devvax.JPL.NASA.GOV> Date: 18 Feb 91 20:24:31 GMT References: <4861@ruuinf.cs.ruu.nl> <27BC1A2A.642C@tct.uucp> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 20 In article <27BC1A2A.642C@tct.uucp> chip@tct.uucp (Chip Salzenberg) writes: : According to marvit@hplpm.hpl.hp.com (Peter Marvit): : >I tried doing a s|\w.|tr[a-z][A-Z]| and some variants, but nothing worked : >correctly. I plead to the perl community for help. : : This worked for me: : : s/\b([a-z])/$x=$1,$x=~tr#a-z#A-Z#,$x/ge In 4.0 beta, you can say s/\b([a-z])/\u$1/g; which vi users may recognize. In fact, you could get away with s/\b./\u$&/g; though that does twice as much work. Larry