Sent: Saturday, June 18, 2005 12:58 PM To: beginners@perl.org Subject: change char, keep case
Hi all, quite interesting, how you would write this without $temp: use strict; use warnings; my $first = 'B'; my $second = 'a'; ($first, $second) = ($second , $first); print $first, "\n"; print $second, "\n"; but I want keep case of chars, so output is: "Ab" Have a nice day :) Have you read perldoc ? DEV,SUN2>perldoc -f uc uc EXPR uc Returns an uppercased version of EXPR. This is the internal function implementing the "\U" escape in double-quoted strings. Respects current LC_CTYPE locale if "use locale" in force. See perllocale and perlunicode for more details about locale and Unicode support. It does not attempt to do titlecase mapping on initial letters. See "ucfirst" for that. If EXPR is omitted, uses $_. DEV,SUN2>perldoc -f ucfirst ucfirst EXPR ucfirst Returns the value of EXPR with the first character in uppercase (titlecase in Unicode). This is the internal function implementing the "\u" escape in double-quoted strings. Respects current LC_CTYPE locale if "use locale" in force. See perllocale and perlunicode for more details about locale and Unicode support. If EXPR is omitted, uses $_. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>