$lastname = ucfirst ($lastname) if ($lastname =~ /^[a-z]/);
as far as the telephone number thing, it depends on how many formats you need to handle (international numbers, etc)
Just choose a set of standards and enforce 'em, for example US numbers all look like (123) 456-7890.
So remove whitespace, check for 3 in parens, 3 outside, dash, then 4. If not, check to see if there is the correct number of digits, and if so, split em up and add the extra punctuation yourself.
You just need to adopt a similar standard for any number format you might be handling (and extend the US one for extensions, etc).
Trinary