Re: [Templates] Array of hashes or hash refs
[prev]
[thread]
[next]
[Date index for 2004/09/24]
On Fri, 24 Sep 2004, Harald Joerg wrote:
> > { LastName => Smith, FirstName => John, ID => BR549 }
>
> Note that you may omit quotes on hash keys, but not on values.
Yeah I let math and perl get mixed together here. I use the => when I
want to convey to others that is isn't really equal but implies. I let it
slip through while typing too quickly.
> %CSI = (ToDay => 'Sep 23, 2004'; PageTitle => 'Not doing so well');
> @array = ([ LastName => 'Smith', FirstName => 'John', ID => 'BR549' ]
> ,[ LastName => 'Anderson', FirstName => 'Rod', ID => 'BR007' ]
> );
>
> $sut->process($filename
> ,{'CSI' => \%CSI
> ,'array' => \@array
> }
> );
>
> ...and in your template you can have things like:
>
> At [% CSI.ToDay %] [% array.0.FirstName %] [% array.0.LastName %] was
> [% CSI.PageTitle %].
Gotcha!
Rod
--
"Open Source Software - You usually get more than you pay for..."
"Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL"
_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates