in reply to change case

Or you could use a single regular expression -
#!/usr/local/bin/perl -w use strict; while (<DATA>) { s/(\w+)/\u\L$1/g; print "$_"; } # or just a one liner - # s/(\w+)/\u\L$1/g, print for <DATA>; __DATA__ foo bar ned KelLy james bond
And the output is -
Foo Bar Ned Kelly James Bond