Hi,
   I have a cgi program that pulls data out of a database and stores it in
an array ref.  I would like to display this data one row at a time. 
Unfortunately I am having difficulty getting the current index to persist
from one page to another.  I could do this with a hidden field.  But I also
have difficulty getting the array ref to persist once the submit button is
pushed.
   The general scenario is this.  I have a function which sets a value of
x.  I would like to have that
value of x available on the next call to the function.  (Like its supposed
to be a static variable.)

Here is what I tried:

our %x

sub fu{
    my ($bar) = @_; 
    our %x;  
       if ($bar){
            $x{'ABC'} = 0
       } 
       else{
            $x{'ABC'} = $x{'ABC'} + 1;
       }
       print "Value = $x{'ABC'}", hr;

fu(1);
<push submit button>
fu(0);

gives
Value = 0
Value = 
}
How should I be doing this?

mary anderson








-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to