my $name = 'John'; my $html = get_html(); # sub name corrected # later... sub get_html{ my $html = < my html

Hi there $name

HTML return $html; } ####

Hi there

##
## my $html = get_html(); $html =~ s//$name/; #### my $html; { local $/; my $file = 'template.html'; open my $fh, '<', $file or die "can't open $file to read: $!"; $data = <$fh>; close $fh or die "cannot close $file: $!"; }