http://www.perlmonks.org?node_id=163156


in reply to regexp word break help

Does it have to be a regexp? Why?
use Text::Wrap qw(wrap $columns); $columns = 45; my @lines = wrap('', '', 'Make sure this string is 45 chars or less, a +nd if you have to truncate it to make it shorter, only break it betwe +en a word (\s)'); print @lines;

stephen