While there may be a better way to do this, I just added a simple regex:
#!/usr/local/bin/perl
use strict;
my $name = "Fred";
my @infile = <DATA>;
my $tmpl = join '', @infile;
$tmpl =~ s/\$name/$name/g;
# output
print $tmpl;
__DATA__
This is my template.
Here is my $name