#!/usr/bin/perl use strict; use warnings; use Text::Wrap; my $s = '1234,4325,545678910,6544,4345,5443,3455,4321'; $Text::Wrap::columns = 15; $Text::Wrap::break = ','; # use this line if you need trailing commas at the end of each line #$Text::Wrap::separator = ",\n"; print wrap('', '', $s); __END__ C:\Old_Data\perlp>perl text_wrap2.pl 1234,4325 545678910,6544 4345,5443,3455 4321