Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!ames!fxgrp!grady From: grady@fx.com (Steven Grady) Newsgroups: comp.lang.perl Subject: uppercasing the first letter of the input Summary: is there a better way to do this? Message-ID: <1990Sep25.002313.24175@fxgrp.fx.com> Date: 25 Sep 90 00:23:13 GMT Sender: news@fxgrp.fx.com (News) Reply-To: grady@fx.com Organization: FXD/Telerate, Mountain View, CA Lines: 17 Is there a better way to uppercase the first letter of the input than the following: perl -pe 's/./($up = $&) =~ tr^a-z^A-Z^; $up/e' I don't like using the extra variable. I'd prefer: perl -pe 's/./$& =~ tr^a-z^A-Z^/e' but the return value of the "tr" expression is the number of matches, rather than the translated string itself.. -- Steven grady@fx.com "Once the trust goes out of a relationship, it's no fun lying to them anymore."