in reply to A question of logic and syntax

Don't try to use a simple ucfirst to 'fix' names since for many names such as "McCarthy O'Neil", and other complex names will be broken. However the CPAN module Lingua::EN::NameCase is designed to use all the special rules to create the right case.
$name = nc($name); # change if ($name eq nc($name)) {} # test