in reply to Rounding to the nearest word

Are you looking for Text::Wrap?

Caution: Contents may have been coded under pressure.