in reply to Creating an HTML table with 'n' rows

foreach is a statement, not an expression, so it can't fit inside another expression (unless you wrapped it in a do block, but that's another set of problems).

what you want is a map operator. I show many uses of such in my WebTechniques columns. Go there, and cut-n-paste at will.

-- Randal L. Schwartz, Perl hacker

  • Comment on RE: Creating an HTML table with 'n' rows

Replies are listed 'Best First'.
RE: RE: Creating an HTML table with 'n' rows
by elwarren (Priest) on May 17, 2000 at 21:05 UTC
    You don't have to do this inside the table call. If you initialize your cgi object like this: use CGI qw(*table); then you can use the start_table and end_table with a loop (or anything you want) between them:
    use CGI qw(*table); print start_table({-border=>0, -cellspacing=>0, -width=>'100%'}), "\n" +; for $data (@list) { print "row data loop\n"; } print end_table;