"Guruguhan N" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi All,
Hello.
Please read Charles K. Clarkson's comments. They are spot on. I will not
repeat them here.
> In reply to my own posting, I have written a code like the one given
below.
> @X = (1 .. 30)
> $n_el = scala
N, Guruguhan (GEAE, Foreign National, EACOE) <> wrote:
: In reply to my own posting, I have written a code
: like the one given below.
:
: @X = (1 .. 30);
:
: $n_el = scalar(@X);
: $n_row = $n_el/3; # 3 is the number of columns I want.
:
: for ($i=0; $i<$n_row; $i++) {
: f
Hi All,
In reply to my own posting, I have written a code like the one given below.
Let @X = (1 .. 30)
$n_el = scalar(@X);
$n_row = $n_el/3; # 3 is the number of columns I want.
for ($i=0; $i<$n_row; $i++) {
for ( $j=$i; $j <$n_el; $j+=$n_row) {
printf ( "%4d\t
N, Guruguhan (GEAE, Foreign National, EACOE) 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?
If you want the data to read across, then down, you can do:
@X = 'A' .. 'Z';
$m = 8;
p
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";
}
-O
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 hav