in reply to 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?
It has come to our attention that you are delinquent in your {$monthname[$last_paid_month]} payment. Please remit ${sprintf("%.2f", $amount)} immediately, or your patellae may be needlessly endangered. Love, Mark "Vizopteryx" Dominus
#!/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 $result = $template->fill_in(HASH => \%vars1); if (defined $result) { print $result } else { die "Couldn't fill in template: $Text::Template::ERROR" } my %vars2 = (title => 'Mr.', firstname => 'Bill', lastname => 'Gates', ); $result = $template->fill_in(HASH => \%vars2); if (defined $result) { print $result } else { die "Couldn't fill in template: $Text::Template::ERROR" }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Text::Template=>How to fill in with more than one time?
by castaway (Parson) on Sep 04, 2003 at 07:00 UTC | |
|
Re: Re: Re: Text::Template=>How to fill in with more than one time?
by ctilmes (Vicar) on Sep 04, 2003 at 12:54 UTC | |
by taizica (Novice) on Sep 04, 2003 at 13:36 UTC | |
by ctilmes (Vicar) on Sep 04, 2003 at 12:57 UTC | |
|
Re: Re: Re: Text::Template=>How to fill in with more than one time?
by perrin (Chancellor) on Sep 04, 2003 at 12:36 UTC |