Harald Joerg wrote:
To check whether I've understood your problem, here is a complete
program which should do what you want, with two different versions of
the template in the __DATA__ section:
----------------------------------------------------------------------
#!/usr/bin/perl -w
use strict;

use Template;

my $tt = Template->new();

my $dataFile = {name   => "Curve Matrix",
               ,matrix =>
                [[0,365,1095,1825,3650,2555],
                 [2.3,0.142,0,0,0,0],
                 [2.4,0,1.72,0,0,1.71],
                 [2.5,0,0,1.75,1.90,0],
                ]
                };

$tt->process(\*DATA,{dataFile => $dataFile}) or die $tt->error();

__DATA__
[%- FOREACH line = dataFile.matrix %]
    [%- FOREACH column = line %]
        [%- column %][% IF NOT loop.last %],[% END %]
    [%- END %]
[%  END %]

[%- FOREACH line = dataFile.matrix %]
    [%- GET line.join(',') %]
[% END %]
----------------------------------------------------------------------
Wow, except for minor formatting and "IF NOT" vs "UNLESS", I would have thought you'd posted MY test script. :) :)

Awesome.

--mark

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to