=for comment Here we retain Juerd's nice readable curly-brace syntax, and we also allow for reusable code (by assigning to global output string) allow for paramaterized tags (by using array ref with prm_table) allow for multiple-nested tags of any nesting-depth =cut ### INIT ### ---------------------------------------------- use strict; use warnings; ### INIT vars; global output string buffer; params for the parent table; my $out; my $set_prm_table = [qw(red 1 100%)]; sub prm_table (&@){ my $st = $_[1] || ""; $out .= ""; $_[0]->(); $out .= "
"; } sub row (&) { $out .= "\n"; shift->(); $out .= ""; } sub cell (&) { $out .= "\n"; shift->(); $out .= "";} ### DISPLAY OUTPUT ### ---------------------------------------------- prm_table { for (1 .. 3){ row { cell {$out .= "foo $_"} } } }$set_prm_table; print $out; print "\n---------------------------\n";