my $template = Text::Template->new( TYPE => 'FILE', SOURCE => 'formletter.tmpl', ) or die $Text::Template::ERROR; #### Dear {$name}, It has come to our attention that you are delinquent in your {$month} payment. Please remit {$amount} immediately, or your patellae may be needlessly endangered. Love, Mark "Vizopteryx" Dominus #### Gates,Bill,Mr.,1,42000000000 Wall,Larry,Mr.,5,2 #### my @monthname = qw(January yadda yadda December); open FH, '<', 'data.csv' or die "can't open data file: $!"; while () { chomp; my ($last,$first,$title,$month,$amount) = split ',', $_; my $result = $template->fill_in(HASH => { name => "$title $first $last", month => $monthname[$month], amount => sprintf('%.2f',$amount), }); die $Text::Template::ERROR unless $result; print $result; }