#!perl-w use Text::Wrap; $string = "this is just a test\nthis is another test\nthis is yet a nother test\n"; $Text::Wrap::columns = 4; print wrap('', '', $string);