in reply to Insert Space between names

Another solution as long as your data conforms to the last name being capitalized.

$name =~ s/([a-z])([A-Z])/$1 $2/;

Handles the situation where you might have JohnMcDoe correctly.