Hi All,

I have a list of names all in uppercase that I would like to 
capitaIise. I can't help but think that map could make short work of 
this loop but I am not sure how. Is it possible to use map here 
instead of a for loop? I can see there are going to be issues with 
double-barrelled names but I'll cross that bridge later.


Thanx,
Dp,.

while (<DATA>) {

 my @words = split(/\s+/,$_);
 my $str;
 foreach my $w (@words) {
        my $s = lc($w);
        $s = ucfirst($s);
        $str .= $s.' ';
 }
 print "STR=$str\n";
}

__DATA__ 
SOME NAME
SOMEONE WITH FOUR NAMES
ONE WITH THREE
A-HYPENED NAME


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to