bobbybobbertson
Programmer
I've got a perl problem. I sort of want to use a php style "include" file in perl.
What I mean is that I have a file that has a bunch of html in it. However, inside that html file is a variable. I have a perl cgi program that reads that html file and includes it in its output to the browser.
So the perl program reads the html file and spits it out to the browser. However the variable is not interpolated. Is there a way to get the variable interpolated.
Below is a short version of what I'm doing. The goal is to be able to run the perl file and have it output "this is interpolated text":
include.html
==========
<html>
<head>
</head>
<body bgcolor="#ffffff">
@interpolate_me
</body>
</html>
output_include_file_with_interpolation.pl
=============================
use CGI:retty;
print $cgi->header();
my @interpolate_me = "this is interpolated text"
open INPUT , "include.html" or die $!;
my @include_file = <INPUT>;
print @include_file;
close INPUT;
What I mean is that I have a file that has a bunch of html in it. However, inside that html file is a variable. I have a perl cgi program that reads that html file and includes it in its output to the browser.
So the perl program reads the html file and spits it out to the browser. However the variable is not interpolated. Is there a way to get the variable interpolated.
Below is a short version of what I'm doing. The goal is to be able to run the perl file and have it output "this is interpolated text":
include.html
==========
<html>
<head>
</head>
<body bgcolor="#ffffff">
@interpolate_me
</body>
</html>
output_include_file_with_interpolation.pl
=============================
use CGI:retty;
print $cgi->header();
my @interpolate_me = "this is interpolated text"
open INPUT , "include.html" or die $!;
my @include_file = <INPUT>;
print @include_file;
close INPUT;