next up previous contents
Next: MICwhile Up: MIClist Previous: Syntax   Contents

Description

MIClist is analogous to a `foreach' command. MIClist is used to iterate over a list and perform operation on or display each element. The `list' parameter defines how the list is to be generated, or may even specify a literal Perl list which is currently in scope. The `iterator' parameter defines the name of the variable which shall contain each of the elements of the list. This variable will be lexically scoped to the block containing the MIClist. Example:

<table>
<MIClist list="&amp;get_accounts" iterator="$account">

<tr><td>Name: [+ $account-&gt;name; +] </td>
	<td>Acc. Number: [+ $account-&gt;number; +]</td>
	<td>Balance: [+ $account-&gt;balance; +]</td>
</tr>

</MIClist>
<!-- $account is now out of scope -->
</table>

might produce output something like:

Name: Mr. MIC       Acc. Number: ad192381  Balance:  $12,000.00
Name: Hojo McMorman Acc. Number: 918231    Balance:  $0.27