Bob Showalter [BS], on Friday, September 10, 2004 at 10:33 (-0400)
wrote these comments:

>> I want print all items into table, table should have 3 columns.
>> I don't know how to do it.
BS> What you have prints one row with two columns. It looks like perhaps you
BS> want two rows with three columns in each row.

yes, you are right. I want print some rows with three columns, rows
are ofcourse depend on input data.

BS>    #!/usr/bin/perl
BS>    use strict;
BS>    use CGI ':standard';
BS>    my @items = map "value $_", 1..10;
BS>    my $ncol = 3;
BS>    print Tr([ map td([ @items[ $ncol * $_ .. $ncol * $_ + $ncol - 1 ] ]),
BS>        0 .. @items / $ncol]);

very very nice clear script! I did play it it and the map function is
so powerful in this way.

BS> If you can get all the maths down right, this kind of thing is extremely
BS> powerful for generating dynamic tables, forms, etc. Take a look at "perldoc
BS> CGI" under the heading "THE DISTRIBUTIVE PROPERTY OF HTML SHORTCUTS"

thanks for nice answer, I did change my routine with this one, and now
the code is about 10 lines shorter :)
Thanks again.

-- 

 ...m8s, cu l8r, Brano.

[Old sci-fi actors never die, they just go to Babylon Five.]



-=x=-
Skontrolované antivírovým programom NOD32


-- 
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