I can't test this out where I am, but here's one thought...
 
##############
 
my $columns = 5;
my $i = 0;
while($i < ($#X + $columns)){
   for($i..$i+$columns){
      print $X[$_];
      for(1..(20 - length($X[$_])){
         print " ";
      }
   }
   print "\n";
}
 
################
 
 
-----Original Message----- 
From: N, Guruguhan (GEAE, Foreign National, EACOE) [mailto:[EMAIL PROTECTED] 
Sent: Fri 6/18/2004 4:38 AM 
To: [EMAIL PROTECTED] 
Cc: 
Subject: printing array elements in columns



        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?
        
        TIA
        Guruguhan
        
        
        --
        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