Here's my offer (you can change $num_items_in_td and $num_cols):
use CGI qw(:standard);
open (FH, "items.txt") or die "Can't open file. Cause: $!";
my @items = sort <FH>;
chomp(@items);
print header();
$num_cols = 2;
$num_items_in_td = 2;
for ($i = 0; defined($items[$i]); $i += $num_items_in_td) {
push @tds, td(@items[$i..($i+$num_items_in_td-1)]);
if ($i+$num_items_in_td > $#items || @tds % $num_cols == 0) {
push @trs, Tr({-align=>CENTER,-valign=>TOP}, @tds);
@tds = ();
}
}
print table(
{-border=>undef},
caption('Choose your favourite brand:'),
@trs
);
-------------------------------
Alexander Kleshchevnikov,
DirectEDI Developer
email: [EMAIL PROTECTED]
icq: 153617972
-------------------------------
"Ing. Branislav Gerzo" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi CGIers!
>
> I have small question about putting variables into CGI script, which
> produces table, here is snip of code:
>
> use CGI qw(:standard);
> #...
> open FH, items.txt or die "Can't open $!";
> my @items = sort <FH>;
> print table(
> {-border=>undef},
> caption('Choose your favourite brand:'),
> Tr({-align=>CENTER,-valign=>TOP},),
> td($items[0], $items[1], $items[2]),
> td($items[3], $items[4], $items[5])
> );
> #...
>
> But how to do that inside while loop ? Can I use table() function, or
> I have to print it (like without CGI module)?
>
> Thanks for any help.
>
>
> -=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>