[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] interpolating



I'm working on a project that uses html templates replacing comments with the appropreate variable.

#####template#####
<html><body>hello <!--$name--></body></html>
###############
#####code#####
#1perl
$file = $ARGV[0];
$name = 'bill';

print "content-type: text/html\n\n";
open FILE, "<$file" or die "cannot open '$file'";
     while (<FILE>) {
          s/<!--(.*?)-->/\1/;
          print "$_";
     }
close FILE;
__END__
###############
#####desired output#####
content-type: text/html

<html><body>hello bill</body></html>
###############

or something along those lines will capture all instances of the variables that need replacing. But how would I interpolate $_ before sending it back? I mean something aside from a long list of s/\$name/$name/; etc

le meas,
--Nick

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org