$variable should be avaiable anywhere in the main part of the script.
some things that may help:
are you trying to reference it in a function without passing it in?
are you using it in another script without passing it to that script?
if these don't help post your code so I can look at it.
Ace21