>At 03:59 PM 9/8/00, G.W. Haywood wrote:
>Try to think of it as a program.  You can't use the variable's value
>until you've set it.  Why does it matter where it goes in the page?

Not exactly true for Perl, is it? -- the BEGIN subroutine comes to 
mind.  What follows is just a speculation on my part, hopefully Joshua or 
someone else who knows better will correct me if I'm wrong...  As I 
understand the way ASP code is parsed, everything is converted to a perl 
script with patches of HTML replaced by print statements.  This perl script 
is then submitted to eval().  Assuming this is true, I think you should be 
able to use the BEGIN subroutine to initialize your variables just like in 
a normal perl script.

  Hello <%=$name%>
  <%
   BEGIN {
     $name="something";
    }
  %>

Of course, if you have variables that need to be initialized for every 
script you run, you should probably use Script_OnStart.

Dmitry

PS  Perhaps I should've test this first, before talking off my ass.

>If you really want to separate it, use Response->Include or something.
>>
>>On Fri, 8 Sep 2000, Issam W. Alameh wrote:
>>
>> > I want to have something like
>> > ------------------------
>> > Hello <%=$name%>
>> > <%
>> > $name="something";
>> > %>
>> > ------------------------

Reply via email to