in reply to Output

So it seems like you're looking for a way to split up a list of sub-categories into bunches of 3, then? Is that it?

Try this:

my %subcat = (Foo => 3, Bar => 2, Baz => 10, Quux => 1); my $index = 0; print "<TR>\n"; for my $sc ( keys %subcat ) { print "<TD>", $sc, " (", $subcat{$sc}, ")</TD>\n"; print "</TR>\n<TR>\n" if ++$index % 3 == 0; } print "</TR>\n";
Does that do what you want?

Replies are listed 'Best First'.
RE: Re: Output
by Anonymous Monk on May 10, 2000 at 02:43 UTC
    you may also want to fill out the last row with empty cells by adding the following code between the for loop and final print call:
    print "<TD>&nbsp;</TD>\n" while (index++ % 3);
RE: Re: Output
by Anonymous Monk on May 10, 2000 at 00:42 UTC
    You're a life saver!!

    Thanks a million.
    I might have some more questions, I am a newbie teaching myself so I am running into a lot of problems.

    Thanks again.