From: Paul Lutus Date: 2006-12-12T04:50:07+09:00 Subject: Re: format problem chen li wrote: > Hi Paul, > > Thank you so much for your time and input. > > I just need to print a 2D array to screen in the > following format: > > [ > [1,2,3,4,5,6,7,8,9,10,11,12], > [13,14,15,16,17,18,19,20,21,22,23,24], > .. > [85,86,87,88,89,90,91,92,93,94,95,96]] > > > > After I create a 2D array of 8 row x12 column 2D from > a 1D array I want to print this format directly to the > screen without writing further code lines. If the > column number is less than 10 I can print the > data(using pp) in the format above but if column > number is 12 I can't. To solve this the only thing I > can do is to write another loop(see below) to go > through to the same 2D again. > > _2D_array.each{|i| puts i} Problem: The library 'pp' cannot produce the result you want. Solution: don't use 'pp'. Instead, write an additional line of code. -- Paul Lutus http://www.arachnoid.com