Several people have addressed the problem of forcing the
first character of a string to be uppercase, but the problem as presented is more
difficult. I don't have a solution, but I may be able to clarify the
problem.
We do not wish to force the first character to be uppercase.
We wish t
John W. Krahn [JWK], on Saturday, June 18, 2005 at 12:11 (-0700)
typed:
JWK> $ perl -le'
JWK> my $first = 'B';
JWK> my $second = 'a';
JWK> ( $first, $second ) = map lc eq $_ ? uc : lc, ( $second , $first );
JWK> print for $first, $second;
JWK> '
JWK> A
JWK> b
thanks John, nice solution, but if
Ing. Branislav Gerzo wrote:
Elvis Cehajic [EC], on Saturday, June 18, 2005 at 19:11 (+0200) wrote:
EC> Like that?:
EC> use strict;
EC> use warnings;
EC> my $first = 'B';
EC> my $second = 'a';
EC> ($first, $second) = (uc($second) , lc($first));
EC> print $first, "\n";
EC> print $second, "\n";
Ing. Branislav Gerzo schrieb:
Elvis Cehajic [EC], on Saturday, June 18, 2005 at 19:11 (+0200) wrote:
EC> Like that?:
EC> use strict;
EC> use warnings;
EC> my $first = 'B';
EC> my $second = 'a';
EC> ($first, $second) = (uc($second) , lc($first));
EC> print $first, "\n";
EC> print $second, "
Elvis Cehajic [EC], on Saturday, June 18, 2005 at 19:11 (+0200) wrote:
EC> Like that?:
EC> use strict;
EC> use warnings;
EC> my $first = 'B';
EC> my $second = 'a';
EC> ($first, $second) = (uc($second) , lc($first));
EC> print $first, "\n";
EC> print $second, "\n";
sorry, I was not clear. I d
Ing. Branislav Gerzo schrieb:
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"
H
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
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 :)
--
To unsub