Avi Rao <[EMAIL PROTECTED]> on Feb 12, 2002:

> #!usr/local/bin/perl
>
> use Template;
>
> my $tt= Template->new;
>
> $tt->process('my_template', \%data) || die $tt->error;
>
> my @teams = ({ name   => 'Man Utd',
>              played =>  16,
>                won    =>  12,
>              drawn  =>  3,
>                lost   =>  1
>            },
>              { name   =>  'Liverpool',
>              played =>  15,
>                won    =>  11,
>              drawn  =>  2,
>                lost   =>  1
>            }
>             );
>
>
>
> my %data = ( name   => 'English Premier League',
>            season => '2000/01',
>              teams  => \@teams );

Don't you see that at the time you process the template %data is still
empty. Then, after processing the template you fill the variables, but
that's too late.

Next time, 'use strict' and the -w switch before you go to the mailing
list. Try this header for your code and you'll see, it won't even run:

        #!/usr/local/bin/perl -w

        use strict;
        use Template;
        ... your code here ...


HTH, Hans



Reply via email to