in reply to Re^2: global var
in thread global var

See GotToBTru's post to create a proper example, but from your code, I see this:

# exported functions

That makes me think you copy/pasted something off of the Internet, and with the lines that follow that comment, it appears it closely resembles perl4 code (or someone coding perl5 that hasn't migrated to the perl5 mindset yet. This was nearly two decades ago!).

I feel that you need some new resources to read, research and reflect upon. Is this a project that you were forced into and are trying to adjust by chance?