in reply to Re: Global Variables Not Acting Global
in thread Global Variables Not Acting Global

Next and Prev are being set. I can add another parameter, but shouldn't a global variable be global? Does the if block override a global variable's value?
  • Comment on Re^2: Global Variables Not Acting Global

Replies are listed 'Best First'.
Re^3: Global Variables Not Acting Global
by bart (Canon) on Apr 21, 2011 at 11:33 UTC
    No, in Perl a variable is global, anywhere, unless there's a my declaration in a surrounding block. I don't think variable scope is your problem.
Re^3: Global Variables Not Acting Global
by moritz (Cardinal) on Apr 21, 2011 at 11:40 UTC
    If both are set, of course the value is 0 again -- one of them takes care of increment, one of decrementing. Both add up to 0 in the end.
      Only one gets set at a time. There is a form on the bottom with 2 submit buttons. Depending on which button redisplays the form, CurIDPtr is incremented or decremented. Problem is, the value of CurIDPtr is reset every time the form loads. I think I just figured that part out...
        Problem is, the value of CurIDPtr is reset every time the form loads.

        Of course. Each page load starts the CGI script anew, and the variable, while global, is not persistent.