http://www.perlmonks.org?node_id=510334


in reply to Insert Space between names

One solution:

my $string = "JohnDoe"; $string =~ s/(.)([A-Z])/$1 $2/g; print $string;