Perl: Regular Expressions Examples

Published: Friday, 30 April 2004

Capitalise each word.

Use the following substitution:

s/(\w*)/\u\L\1/g;

\w* represents a word.

\L means lowercase the whole word.

\u means uppercase the first letter of the word.