davehodg has asked for the wisdom of the Perl Monks concerning the following question:
Straightforward stuff so far. Now, that structure needs to be mangled into something totally different for the benefit of HTML::Template whilst maintaining the order of things:$result = [ { mag_name => "mag1", issue_num => "01", article => "art1" }, { mag_name => "mag1", issue_num => "01", article=> "art2" }, { mag_name => "mag1", issue_num => "02", article=> "art1" }, { mag_name => "mag1", issue_num => "02", article=> "art2" }, { mag_name => "mag3", issue_num => "01", article=> "art1" } ] ;
I've probably mislaid some parens there but hey.$data = [ { 'magazine_name' => 'mag1', 'issue_loop' => [ { issue_number => '01', article_loop => [ { article_name => 'art1' } { article_name => 'art2' } ], }, { issue_number => '02', article_loop => [ { article_name => 'art1' } { article_name => 'art2' } ] }, { 'mag_name' => 'mag2', 'issue_loop' => [ { issue_number => '01', article_loop => [ { article_name => 'art1' }, { article_name => 'art2' } ] }, { issue_number => '02', article_loop => [ { article_name => 'art1' }, { article_name => 'art2' } ] } ] ;
|
|---|