perl -wlne"printf qq[\t'%s'\n], join qq['+\n\t'], m[(.{1,34}(?: |$)|.{34})]g" junk.txt 'Here is one big long string which '+ 'needs to have some formatting done '+ 'to it before I can use it for '+ 'input in a separate program.' 'I would like it to be formatted '+ 'exactly as follows (except for the '+ 'exact line length)'