in reply to Re: Category List
in thread Category List
You can avoid using a hash if you loop through @listnelements at a time, which has the added bonus of flexibility (for when you want to change the number of columns later on).
#!/usr/bin/perl -wT use strict; my $columns = 2; # change this as needed my @list = sort qw(stereo tv monitor scanner keyboard mouse banana) +; while ( my @column = splice( @list, 0, $columns ) ) { printf "- %-20s", $_ foreach @column; print "\n"; # print TR( td( \@column ) ), "\n"; # CGI.pm-ized :-) }
--k.
|
|---|