Thanks for your attention...
Me thinks, its a good idea for HTML::Template to automatically interpolate
[11,22,33] as [{anon => 11}, {anon => 22}, {anon => 33}]
I do the following all the time when using HTML::Template
$a = [11,22,33];
$template->param(Info => [map {{anon => $_}} @$a]);
it may be a good enhancement for HTML::Template to "automatically" do this.
----- Original Message -----
From: Stefan Seifert
Sent: Tuesday, January 15, 2002 7:57 AM
To: Venkataramana Mokkapati
Cc: HTML::Template List
Subject: Re: [htmltmpl] Iterate thru Arrayrefs
Venkataramana Mokkapati wrote:
>How do I iterate through an ArrayRef?
>
>$template->param(Info => [11,22,33]);
>
>Looks like, HTML::Template ALWAYS needs HashRef to iterate.
>Is my understanding correct?Get more from the Web. FREE MSN Explorer download :
>http://explorer.msn.com
>
Yes you are correct.
You need to do $template->param(InfoLoop => [{Info => 11}, {Info => 22},
{Info => 33}]);
This way you get a loop named InfoLoop and in this loop you have the
vars named Info;
<TMPL_LOOP INFOLOOP>
<TMPL_VAR INFO>
</TMPL_LOOP>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] more from the Web.
FREE MSN Explorer download : http://explorer.msn.com