#example 2 $content =~ s/(.{1,$width}) |([^ ]{$width})/$1$2
/g; print $content;