use Text::Wrap qw( wrap ); local $Text::Wrap::columns = 80; local $Text::Wrap::break = qr/(?<=,)/; local $/ = ','; print wrap('', '', $_) while ;