With some indentation:use Text::Wrap; # Set the line length ('columns') to which the text should be wrapped $Text::Wrap::columns = 20;# Sample text to be wrapped $text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed dignissim, tortor ac cursus consequat, nisi libero eleifend dolor, id vehicula libero sapien eget risus. Aliquam a volutpat tortor."; print( wrap("", "", $text) . "\n" );Output: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed dignissim, tortor ac cursus consequat, nisi libero eleifend dolor, id vehicula libero sapien eget risus. Aliquam a volutpat tortor.
print( wrap(">>>>>", ">", $text) . "\n" ); Output: >>>>>Lorem ipsum >dolor sit amet, >consectetur >adipiscing elit. >Sed dignissim, >tortor ac cursus >consequat, nisi >libero eleifend >dolor, id vehicula >libero sapien eget >risus. Aliquam a >volutpat tortor.