--- Benefits: Desc: your benefits Subcategories: Employee Recognition: Url: http://blah.com/recognition/index.html topics: Employee Service Awards: Url: http://blah.com/recognition/employee_service.html General Recognition and Performance-based Awards: Url: http://blah.com/recognition/awards.html Equity Plans: Url: Overridden Regional Content URL! topics: Incentive Plan: Url: http://blah.com/equity_plans/incentive/override.html Url: http://blah.com/index.html Compensation: Subcategories: {} Url: http://blah.com/comp/index.html Corporate Policies: Subcategories: {} Url: http://blah.com/corp_policies/index.html Early Retirement: Subcategories: {} Url: http://blah.com/ero/index.html #### sub createPages { my $filename = shift; my $content = shift; my $desc = $content->{Desc}; my $url = $content->{Url}; my $subcontent = $content->{Regions} || $content->{Categories} || $content->{Subcategories} || $content->{Topics}; open OUT, ">$filename.html"; foreach my $key ( sort keys %$subcontent ) { print OUT buildSubject( $filename, $key, $subcontent->{$key} ); } close OUT; } sub buildSubject { my $filename = shift; my $name = shift; my $content = shift; my $desc = $content->{Desc}; my $url = $content->{Url}; my $subcontent = $content->{Regions} || $content->{Categories} || $content->{Subcategories} || $content->{Topics}; my @out = (); foreach my $key ( sort keys %$subcontent ) { my $url = $subcontent->{$key}->{Url}; push @out, "$key\n" if $url; push @out, $key unless $url; } my $header = "$name"; $header = "$name" if $subcontent; print $subcontent; return "

$header

\n

$desc

\n", join ' | ', @out; } ##
## # INTERPOLATE => 1 [% FOREACH name = Categories.keys %]

$name

[% Categories.$name.Desc %]

[% FOREACH subname = Categories.$name.Subcategories.keys %] $subname [% END %] [% END %]