perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Schilling <>
Subject creative use of $row, $col in tables
Date Thu, 11 Sep 2003 22:35:17 GMT
Just wanted to share this technique and see how others achieve the same 
thing. Anyone else doing something similar or have a better trick?

Here's some code that creates a nice, compact table definition around a 
set of tuples returned from a database (in this case gnucash).

[- $oldmaxcol = $maxcol;
    $maxcol = 3;

<TABLE border="1">

[- # read in a record from the gnucash database using the Pg interface

<TR><TD>[+ $accountinfo[$col+$row-$row] +]</TD></TR>


[- $maxcol = $oldmaxcol; -]


I'm using $row-$row ($row minus $row equals zero) in the arrary 
reference just to get Embperl to see the $row reference in a statement 
and stop outputting the table when no more records are read from the 
database ( $accountinfo[$col+$row-$row], which is the same as 
$accountinfo[$col] will be undefined if a record is not read).

The purpose of the code is to minimize the lines of code to get the 
table generated properly.


Ricahrd Schilling

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message