Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I wonder what to do if this would happen:my $city_state = “ BELLMONT NY”; $city_state = join '', map { ucfirst $city_state } split /\s+/ || '' +; # Bellmont NY
Any suggestions or a better more efficient way of doing it?my $city_state = “ NEW YORK NY”; $city_state = join '', map { ucfirst $city_state } split /\s+/ || '' +; # New York NY
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Capitalize only the first letter of the first word in a string
by toolic (Bishop) on Feb 03, 2015 at 20:05 UTC | |
|
Re: Capitalize only the first letter of the first word in a string
by GrandFather (Saint) on Feb 03, 2015 at 20:05 UTC | |
|
Re: Capitalize only the first letter of the first word in a string
by AnomalousMonk (Archbishop) on Feb 03, 2015 at 20:28 UTC |