$_ = 'might get it ---------------test-----------results----------.' s/(\S{30})/$1 /g; # $_ is now # 'might get it ---------------test----------- results----------.'