in reply to How to split a string into chunks of length n or less

Something like this:
my $x = 'abc' x 10; $x =~ s/(.{4})/$1 /sg; print $x, "\n"; __END__ abca bcab cabc abca bcab cabc abca bc

If you only want to insert after word characters, you can use s/(\w{4})/$1 /g instead.