in reply to Re: Re: Text::Template=>How to fill in with more than one time?
in thread Text::Template=>How to fill in with more than one time?
#!/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" }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Text::Template=>How to fill in with more than one time?
by taizica (Novice) on Sep 04, 2003 at 13:36 UTC | |
|
Re: Re: Re: Re: Text::Template=>How to fill in with more than one time?
by ctilmes (Vicar) on Sep 04, 2003 at 12:57 UTC |