December 2002
Intermediate to advanced
496 pages
9h 40m
English
Embperl can generate one- or two-dimensional tables dynamically with the use of $row and/or $col. If either $row or $col (or $cnt) is used within a <table>, Embperl repeats the text between <table> and </table> as long as the expression that includes $row/$col does not evaluate to undef.
For instance, if a program has this code:
[- @nums = (1..5); -] <table> <tr><td>[+ $nums[$row] +]</td></tr> </table>
this means start the table and then use $row to loop through @nums, one element at a time. And because it is $row, each element is treated as a row, so it repeats <tr><td> ... </td></tr>. Therefore, this is the result of this code:
<table> <tr><td>1</td></tr> <tr><td>2</td></tr> <tr><td>3</td></tr> ...
Read now
Unlock full access