[Templates] Stuck on getting data from a nested hash.

Andy Wardley abw@wardley.org
Thu, 17 Aug 2006 21:39:01 +0100


Lesley Binks wrote:
>     %menu = (
>          "Home" => {url => "./", name =>"Home",},
>          "Contact" => {url => "./contact.php", name=>"Contact",},
>     );

Hi Lesley,

Try it like this:

	@menu = (
             { url => ...etc... },
             { url => ...etc... },
         );

> I create a reference to a hash thus :
> 
>      my $vars = {
>             ...
>             head => \%const_head,
>             sitemenu => \%menu,

and this:
	      sitemenu => \@menu,

Then everything else should work.

A