On Fri, 18 Jun 2004 17:08:08 +0530, N, Guruguhan (GEAE, Foreign National, EACOE) <[EMAIL PROTECTED]> wrote:

Hi All,
I have a one dimensional array @X, containing N elements. I would like to know how I can print this N elements in M columns?




print join("\n", @X), "\n";


Or if you have multiple arrays to print as column use Each::Array module from CPAN by Brad Baxter

e.g

use warnings;
use strict;
use Array::Each;

my @array1 = qw(ab bc cd de );
my @array2 = qw(cc dd ee ff gg hh );
my @array3 = qw(11 22 33 44 55 );

my $set = Array::Each->new(
    set   => [ [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] ],
    undef => '-',
    bound => 0,
    );

while( my( $a1, $a2, $a3 ) = $set->each ) {
    printf "%12s %12s %12s\n", $a1, $a2, $a3;
}

__END__
          ab           cc           11
          bc           dd           22
          cd           ee           33
          de           ff           44
           -           gg           55
           -           hh            -

Regards,
Edward WIJAYA
SINGAPORE

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to