A object oriented solution is IMHO the best solution for global variables. If you want to dive into this topic I suggest to read brian d foys review of singleton design patterns.
pelagic
Comment on Re: Global variable vs passing variable from sub to sub