T
Truthless
Hello All,
I am somewhat new to perl and I am having some difficulty with a cgi
script that I am making. This script is supposed to read a html file and
replace certain sections of it with its own variables.
Code similar to this works great. as long as $html is in the actual script.
$variables = "Hello World";
$html = '<h1>'.$variables.'</h1>';
sub print_html {
print "Content-type:text/html\n\n";
print <<End_of_Bottom;
$html
End_of_Bottom
}
This outputs <h1>Hello World</h1>.
The issue I am having is getting the $variables to be parsed if the html
is pulled from a file. As I am doing here...
$confile = 'myfile.html'; #file with <h1>$variables</h1> in it
sub openconf {
open(content,"$confile") or dienice("Cant open $confile : $!");
@ary = <content>;
close(content);
foreach $line (@ary) {
chomp($line);
print "$line\n";
}
}
This will print <h1>$variables</h1>, rather than the desired <h1>Hello
World</h1>.
Could any of you please tell me what I can do to make the variables in
the strings that come from the file handle actually evaluate? There must
be something basic I am looking for.
Thank you for any help.
T.
I am somewhat new to perl and I am having some difficulty with a cgi
script that I am making. This script is supposed to read a html file and
replace certain sections of it with its own variables.
Code similar to this works great. as long as $html is in the actual script.
$variables = "Hello World";
$html = '<h1>'.$variables.'</h1>';
sub print_html {
print "Content-type:text/html\n\n";
print <<End_of_Bottom;
$html
End_of_Bottom
}
This outputs <h1>Hello World</h1>.
The issue I am having is getting the $variables to be parsed if the html
is pulled from a file. As I am doing here...
$confile = 'myfile.html'; #file with <h1>$variables</h1> in it
sub openconf {
open(content,"$confile") or dienice("Cant open $confile : $!");
@ary = <content>;
close(content);
foreach $line (@ary) {
chomp($line);
print "$line\n";
}
}
This will print <h1>$variables</h1>, rather than the desired <h1>Hello
World</h1>.
Could any of you please tell me what I can do to make the variables in
the strings that come from the file handle actually evaluate? There must
be something basic I am looking for.
Thank you for any help.
T.