Actually,
s/(\S{30})(\S)/$1 $2/g
flubbs and gives you
31
characters in the 2nd and following
chunks of a really long 'word' unless you do:
1 while $msg =~ s/(\S{30})(\S)/$1 $2/;
...omitting the trailing
'/g'.
So this would be a nice place to use a
zero-width positive look-ahead assertion:
$msg =~ s/(\S{30})(?=\S)/$1 /g;