my $text = fill_in_string( <<EOM, HASH=>{ 'recipient' => 'John' } );
Dear { $recipient },
Pay me at once.
Love,
G.V.
EOM
print "$text\n";
`
the EOM in <<EOM must be enclosed in single quotes as in <<'EOM' (otherwise $recipient gets substituted by perl). If for example my $recipient = "Pete"; is set then the code appears to work but it doesn't. The substitution is not performed by Text::Template but by perl.
This is elementary but it doesn't work.
`#!/usr/bin/perl
use Text::Template qw(fill_in_string);
my $text = fill_in_string( <<EOM, HASH=>{ 'recipient' => 'John' } ); Dear { $recipient }, Pay me at once. Love, G.V. EOM
print "$text\n"; `
the EOM in
<<EOM
must be enclosed in single quotes as in<<'EOM'
(otherwise $recipient gets substituted by perl). If for examplemy $recipient = "Pete";
is set then the code appears to work but it doesn't. The substitution is not performed by Text::Template but by perl.