[EMAIL PROTECTED] wrote: > Currently I have my script print in a long list .csv file. I need to > print my long list into rows of 20 elements. How can I go about doing > this? > > while ($x = <DATA>) > { > > chop $x; > @arr = split /\s+/,$x; > $temp = @arr; > print "$arr[$temp -1],\n"; > > }
Based on your data, this seems to work: while ( <DATA> ) { chomp; print $_, $. % 18 ? ',' : ",,\n"; } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>