Sunday, June 19, 2005

Contest 4

Okay, contest four is all about "There Is More Than One Way To Do It". For this contest, take the string 'a string to fOrMaT' and format it so that the first letter of each word is capitalized and all other letters are lower case. I've got an example of one way to do it below. Send me all of the ways that you can do it before noon CST on June 24th. The person with the most ways wins a copy of the upcoming edition of Advanced Perl Programming.

Here is my sample:

$x = 'a string to fOrMaT';
print join(' ',(map {ucfirst lc $_} (split /\s+/, $x)));"


Here is the resulting string:

A String To Format


Good luck!