I need to add a code snippet ... that will break the output of the multiple choice table into two, or preferably three columns.
You don't give any indication of acceptable formatting and I'm not inclined to plow through the wall of code to find the "output of the multiple choice table", but maybe something like this will serve. Examples are generated for many different numbers of items, but only a few are shown here.
Output:c:\@Work\Perl\monks>perl -wMstrict -le "my @things = qw( zero one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen ); ;; use constant COLS => 3; use constant FMT => '%10s ' x COLS; ;; for my $max (0 .. $#things) { my @stuff = @things[0 .. $max]; my $k = @stuff / COLS; $k = int($k + 1) if int($k) != $k; ;; my @rows; $rows[$_ % $k][$_ / $k] = $stuff[$_] for 0 .. $#stuff; ;; for my $ar_row (@rows) { printf qq{${ \FMT }\n}, @$ar_row, ('') x COLS; } print '--------------'; } "
zero -------------- zero one -------------- zero one two -------------- zero two one three -------------- zero two four one three -------------- zero two four one three five -------------- zero three six one four two five -------------- ... ... -------------- zero six twelve one seven thirteen two eight fourteen three nine fifteen four ten five eleven -------------- zero six twelve one seven thirteen two eight fourteen three nine fifteen four ten sixteen five eleven -------------- zero six twelve one seven thirteen two eight fourteen three nine fifteen four ten sixteen five eleven seventeen --------------
... I can make a donation, but not a great one.
Yes, any donation, however small, is most welcome — and thank you in advance!
Give a man a fish: <%-{-{-{-<
In reply to Re: Break HTML table output into two or three columns
by AnomalousMonk
in thread Break HTML table output into two or three columns
by Jagtig
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |