Mailing List Archive

each() and Table shortcuts
hi,

is there a way to use the excellent <table> shortcuts that embperl has
with each()?

I'm mainly concerned with a tied hash that hides a huge database, and
this approach :

[- @keys = keys %large_db; -]
<table>
<tr>
<td>
[+ $keys[$row] +]
...

will eat ram like hell, just to never release it ...

and of course I don't want to stop using Emperl's table shortcuts ... I
know how to do it with a [$foreach$] block ...



martin
Re: each() and Table shortcuts [ In reply to ]
>
> is there a way to use the excellent <table> shortcuts that embperl has
> with each()?
>
> I'm mainly concerned with a tied hash that hides a huge database, and
> this approach :
>
> [- @keys = keys %large_db; -]
> <table>
> <tr>
> <td>
> [+ $keys[$row] +]
> ...
>
> will eat ram like hell, just to never release it ...
>
> and of course I don't want to stop using Emperl's table shortcuts ... I
> know how to do it with a [$foreach$] block ...
>

In this case a [$ while ($k, $v) = each (%hash) $] is the only solution.
(You may get it working with Embperl's table feature, but then it becomes
very confusing, so I recomend to use while.

Gerald