in reply to Re^16: the annoying keys "key" and "value"
in thread the annoying keys "key" and "value"

I went ahead and implemented an HTML parser to produce a "DOM" in accordance with the aforementioned structure.

Here is the program to produce HTML from that "DOM":

sub htmlize{ my ($tag_name,$dom)=@_; return $dom unless ref $dom; my $html; my %cnt; my $no_text; $html .="<$tag_name"; # print "<$tag_name"; for my $rank (0..$dom->{'_meta_attr_n'}-1){ my $attr_name=$dom->{'_meta_order'}->[$rank]; if($attr_name eq '/'){ $no_text=1; next; } my $attr=$dom->{$attr_name}->[$cnt{$attr_name}||'0']; $attr = join ', ',@$attr if ref $attr; $html .= " $attr_name=\"$attr\""; # print " $attr_name=\"$attr\""; $cnt{$attr_name}++; # in the unlikely event that a child tag a +nd this attr have the same name } $html .= '/' if $no_text; # print '/' if $no_text; $html .= '>'; # print '>'; for my $rank ($dom->{'_meta_attr_n'}..$#{$dom->{'_meta_order'}}){ my $tag_name=$dom->{'_meta_order'}->[$rank]; $html .= htmlize($tag_name,$dom->{$tag_name}->[$cnt{$tag_name} +||'0']); $cnt{$tag_name}++; } $html.="</$tag_name>" if !$no_text; # print "</$tag_name>" if !$no_text; return $html; }

Is this unwieldy compared to the [{'key'=>$key_name, 'value'=>$value},...] structure?