in reply to Capitalize only the first letter of the first word in a string

Another way:

c:\@Work\Perl>perl -wMstrict -le "for my $s (' bElLmOnT NY', ' NeW yOrK NY', ' sAuLt StE. mArIe MI',) { my $t = $s; my $name = qr{ [[:alpha:]]+ [.]? }xms; $t =~ s{ \b ($name) (?= \s+ $name) } {\u\L$1}xmsg; print qq{'$s' -> '$t'}; } " ' bElLmOnT NY' -> ' Bellmont NY' ' NeW yOrK NY' -> ' New York NY' ' sAuLt StE. mArIe MI' -> ' Sault Ste. Marie MI'
This takes advantage of the fact that a city name or portion thereof looks like a state/provincial zip/postal code abbreviation (but not an ISO one, apparently). See  \u \L and their friends  \U \l \F \Q \E in Quote and Quote-like Operators.


Give a man a fish:  <%-(-(-(-<