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


in reply to Splitting on non-initial uppercase without split

Hi
If I get you right you want to have a blank before each
capital letter except the first one in the string. Right?
If yes use
$s =~ s/.(?=[A-Z])/ /g;

si_lence
update:
The comment of edan is right (sorry to mess it up)
but this should work
$s =~ s/(.)(?=[A-Z])/$1 /g;

si_lence

Replies are listed 'Best First'.
Re^2: Splitting on non-initial uppercase without split
by edan (Curate) on Jan 26, 2005 at 10:43 UTC

    Erm, no. That's going to turn "LikeThis" into "Lik This"

    --
    edan