- or download this
$template_file_string =~ s/\$(\w+)/${$1}/g;
- or download this
my %vars = (
title => 'Foo Bar'
...
my $template = q(<h1>$title</h1>);
$template =~ s/\$(\w+)/$vars{$1}/eg;
- or download this
use Text::Template;
...
or die "Couldn't construct template: $Text::Template::ERROR";
my $text = $t->fill_in(HASH => \%vars);