Alex Rivera | Logout

How can I capitalize the first letter of each word in a string in Perl?

Asked 2008-09-16T21:17:00.170
39

What is the easiest way to capitalize the first letter in each word of a string?

Edit
Report

1 Answer

7
$string =~ s/(\w+)/\u$1/g;

should work just fine

answered 2008-09-16T22:14:12.123

Your Answer