<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV>either use iterators in both controller and template, or use array-refs in both, but don't try to use both at once with only one variable.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR><DIV><DIV>On Jun 19, 2007, at 12:09 PM, John Goulah wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite">On 6/19/07, <B class="gmail_sendername">Michael Reece</B> &lt;<A href="mailto:mreece@vinq.com">mreece@vinq.com</A>&gt; wrote:<DIV><SPAN class="gmail_quote"></SPAN><BLOCKQUOTE class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <DIV style=""><DIV>i believe you are getting an array-ref because you are calling it in list context via the [ ... ] here.</DIV><SPAN class="q"><DIV><BR></DIV><DIV>  my $myalums  = [ $c-&gt;model('MyDB::Alumni')-&gt;search({}, { rows =&gt; 20  }) ] ; </DIV><DIV><BR></DIV><DIV><BR></DIV></SPAN><DIV>try:</DIV><DIV><BR></DIV><DIV>    my $myalums_iter  = $c-&gt;model('MyDB::Alumni')-&gt;search({}, { rows =&gt; 20  });</DIV><DIV>    while (my $alum = $myalums_iter-&gt;next) { ... } </DIV></DIV></BLOCKQUOTE><DIV><BR><BR> </DIV>You are correct (and I did explain that as well in my original post that was happening).  So the question is , how can I make the same call and access the data in both places?  <BR></DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>pick one:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>   my $myalums  = $c-&gt;stash-&gt;{alumni} = [ $c-&gt;model('MyDB::Alumni')-&gt;search({}, { rows =&gt; 20  }) ] ;</DIV>   foreach my $alum (@$myalums) {</DIV><DIV>      print "id: ", $alum-&gt;alum_id, "\n";</DIV><DIV>   }</DIV><DIV>   ...</DIV><DIV>   [% FOREACH alum IN alumni -%]<DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">       id: [% alum.alumni_id %]  &lt;br /&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">   [% END -%]</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>-or-</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><DIV>   my $myalums  = $c-&gt;stash-&gt;{alumni} = $c-&gt;model('MyDB::Alumni')-&gt;search({}, { rows =&gt; 20  });</DIV><DIV>  while (my $alum = $myalums-&gt;next) {</DIV></DIV><DIV>      print "id: ", $alum-&gt;alum_id, "\n";</DIV><DIV>   }</DIV><DIV>  $myalums-&gt;reset;<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN># reset iterator!</DIV><DIV>   ...</DIV><DIV>  [%WHILE (alum = alumni.next) %]</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">       id: [% alum.alumni_id %]  &lt;br /&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">   [% END -%]</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR></DIV><BR></BODY></HTML>