You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.The text was updated successfully, but these errors were encountered: