PERL: Evaluate $'s from external files? - TechRepublic
General discussion
December 18, 2002 at 02:54 AM
elion

PERL: Evaluate $’s from external files?

by elion . Updated 23 years, 5 months ago

I’m writing a Perl script that reads HTML code from a text file, evaluates $ variables in the HTML page, and then prints the page to the browser. Here’s my problem:

Let’s say my HTML page contains the variable $a and my Perl script defines $a = 1. When I print the code to the browser, Perl prints “$a” to the screen instead of evaluating the string and printing “1”.

How can I have Perl open an HTML file containing string variables, evaluate the variables and then print the HTML to the browser?

This discussion is locked

All Comments