That's part of the "magic" of this variable. Explicit looping is not
required.
http://perl.apache.org/embperl/pod/doc/Embperl.-page-3-.htm#sect_8
#############################################################################
Embperl can generate dynamic tables (one- or two-dimensional). You only
need to specify one row or column.
Embperl generates as many rows or columns as necessary. This is done by
using the magic variables $row, $col, and $cnt. If you don't use
$row/$col/$cnt within a table, Embperl does nothing and simply passes the
table through.
Embperl checks if any of $row, $col, or $cnt is used. Embperl repeats all
text between <table> and </table>, as long as the expressions in which
$row or $cnt occurs are defined.
Embperl repeats all text between <tr> and </tr>, as long as the
expressions in which $col or $cnt occurs are defined.
See also $tabmode (below) for end-of-table criteria.
Examples: (see eg/x/table.htm for more examples)
[- @k = keys %ENV -]
<TABLE>
<TR>
<TD>[+ $i=$row +]</TD>
<TD>[+ $k[$row] +]</TD>
<TD>[+ $ENV{$k[$i]} +]</TD>
</TR>
</TABLE>
This will show all entries in array @k (which contains the keys from
%ENV), so the whole environment is displayed (as in the while example),
with the first column containing the zero-based index, the second
containing the content of the variable name, and the third the environment
variable's value.
This could be used to display the result of a database query if you have
the result in an array. You may provide as many columns as you need. It is
also possible to call a 'fetch' subroutine in each table row.
#############################################################################
On Wed, 26 Sep 2007, Perrin Harkins wrote:
> On 9/26/07, Todd White <suppressed> wrote:
> > I'm wondering if anyone on this list would have any knowledge regarding
> > the following Embperl question?
>
> I don't use Embperl, but it looks like you forgot to write all the
> code to loop through your array and increment $cnt.
>
> - Perrin
>
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.