# in rare cases with no spaces: ... $text =~ s/(?!\s)()/ $1/g; ...