Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

code stored in a variable gets executed

Status
Not open for further replies.

jimberger

Programmer
Jul 5, 2001
222
GB
Hi,

I have some code which stores the following text in a variable e.g

$var1 = " testing123 <% Response.Write(test) %> test ";

I want to be able to print this to screen but when i do

print $var1 the browser tries to execute the code thinking its ASP code so all i get is

testing123 test

instead of the desired output

testing123 <% Response.Write(test) %> test

does anyone know how to overcome this problem?

thanks for your time
jim
 
My Guess,

if you view the source you should see <% Response.Write(test) %> test. The Response.Write is hidden because it's in the angle barckets.

When you write code from Perl directly to the browser, there's no opportunity for any other processor to act on any commands therein. A suggestion would be to generate a temporary file, and force a redirect to that, to get the desired processor to work on it.

For dynamic processing in perl scripts to occur after the page has been sent to the browser, I've sometimes generated javascript on the server

Code:
 <script language="JavaScript" src="/cgi-bin/genscript.pl?item=wahtever"></script>

Word of warning though to get the script to fire, you'll need to make sure the content-type is set to text/javascript

Code:
print "Content-Type: text/javascript\n\n";

HTH
--Paul

cigless ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top