# Trivial double loop - build, then print my $aref=[]; #reference to anonymous array. foreach $thing (@thingies) { push @{$aref},foo($thing); } print_table($aref); #... sub print_table { my $aryref=shift foreach my $thing (@{$aryref}) { #etc. } } #### #bypass cgi's html facilities print ''; foreach $thing (@thingies){ #foo returns an array of cell contents. print ''; } print '
',join('', foo($thing)),'
';