in reply to Global Variables Not Acting Global

The value of $CurIDPtr only changes if param('Next') or param('Back') is set. Maybe neither is happening?

And perhaps what you really want is to pass a parameter for that variable through the form, otherwise it'll always be 0, 1, or -1.

Replies are listed 'Best First'.
Re^2: Global Variables Not Acting Global
by rbhyland (Acolyte) on Apr 21, 2011 at 11:20 UTC
    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?
      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.
      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...