#!/usr/bin/perl5.6 use Text::Template; my $template = Text::Template->new(SOURCE => 'formletter.tmpl') or die "Couldn't construct template: $Text::Template::ERROR" +; my @monthname = qw(January February March April May June July August September October November Dece +mber); my %vars1 = (title => 'Mr.', last_paid_month => 1, # February amount => 392.12, monthname => \@monthname, ); my %keepvars = %vars1; my $result = $template->fill_in(HASH => \%keepvars); if (defined $result) { print $result } else { die "Couldn't fill in template: $Text::Template::ERROR" } my %vars2 = (title => 'Mr.', firstname => 'Bill', lastname => 'Gates', ); %keepvars = (%keepvars, %vars2); $result = $template->fill_in(HASH => \%keepvars); if (defined $result) { print $result } else { die "Couldn't fill in template: $Text::Template::ERROR" }
In reply to Re: Re: Re: Text::Template=>How to fill in with more than one time?
by ctilmes
in thread Text::Template=>How to fill in with more than one time?
by taizica
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |