Embperl Examples - Dynamic Tables


This is a example of using the table tag to show the array @arr = ( 'A', 'B', 'C')

[- @arr = ( 'A', 'B', 'C') ; -]
[+ $arr[$row] +]

This is a example of using the table tag in embperl to show the environement

[- @k = keys %ENV -]

Using $row (one value per row)

Row Var Content
[+ $i=$row +] [+ $k[$row] +] [+ $ENV{$k[$i]} +]

Using $col (one value per column, only one row)

[-$maxcol=99-]
[+ $i=$col +] [+ $k[$col] +] [+ $ENV{$k[$i]} +]

Using $cnt and $maxcol (three values per row)

[-$maxcol=3-]
[+ $i=$cnt +] [+ $k[$cnt] +] [+ $ENV{$k[$i]} +]

Display an two dimensional array with one, two and three columns !

Please take a look at the source in your browser to see the difference

[- $a[0][0] = '1/1' ; $a[1][0] = '2/1' ; $a[1][1] = '2/2' ; $a[2][0] = '3/1' ; $a[2][1] = '3/2' ; $a[2][2] = '3/3' ; $maxcol=99 ; -] $a[[0][[0] = '1/1' ;
$a[[1][[0] = '2/1' ;
$a[[1][[1] = '2/2' ;
$a[[2][[0] = '3/1' ;
$a[[2][[1] = '3/2' ;
$a[[2][[2] = '3/3' ;

$tabmode = default

[+ $a[$row][$col] +]

$tabmode=3 + 48 ; $maxcol = 4; $maxrow = 4

[- $tabmode=3 + 48 ; $maxcol = 4; $maxrow = 4 -]
[+ $a[$row][$col] +]

$tabmode=1 + 32 ;

[- $tabmode=1 + 32 ; -]
[+ $a[$row][$col] +]


HTML::Embperl (c) 1997-1998 G.Richter