use strict; my $str; while () { chomp; my @cols = split(/;/); for (my $i=1;$i<=@cols;$i++) { $cols[$i-1]="$cols[$i-1]"; } $str .= '' . join('',@cols) . "\n"; } print $str; exit; __DATA__ a;b;c;d;e f;g;h;i j;k l m;n;o