[ic] more questions on PERL variables

Mike Heins mikeh@minivend.com
Fri, 10 Nov 2000 18:02:56 -0500


Quoting Ed LaFrance (edl@newmediaems.com):
> As far as I know, the only way to access these types of variables is from 
> within [perl][/perl] and [calc][/calc] pairs, and that's assuming that they 
> hold their value once execution leaves the block in which they were 
> set.  Perhaps someone else knows more...

I think I might. 

Yes, the only way is to do [calc] $foo [/calc] (or the [perl] tag). Even
that won't work if you made the variable a "my" variable, i.e.:

[perl]
	my $foo = 'foo';
	$bar = 'bar';
	return;
[/perl]

[perl]
	my $response = "perl: foo=$foo bar=$bar";
	$foo = 'foo';
	return $response;
[/perl]
<br>

[calc]
	return "calc: foo=$foo bar=$bar";
[/calc]
<br>

This will return "perl: foo= bar=bar" and "calc: foo=foo bar=bar".
The calc tag shares the same space.

-- 
Akopia, Inc., 131 Willow Lane, Floor 2, Oxford, OH  45056
phone +1.513.523.7621 fax 7501 <heins@akopia.com>

Fast, reliable, cheap.  Pick two and we'll talk.  -- unknown