http://qs321.pair.com?node_id=17812


in reply to searching backwards in a string

You might want to take a look at one of the CPAN modules to do text wrapping, namely Text::Wrapper, Text::Wrap, or Text::Format.

For a regular expression way to do it, how about:

while($text =~ /(.{0,80})\s+/g) { # result in $1 }