are all variables global unless defined with my
Well, it depends what you mean by 'global'. If you declare a
my variable outside a subroutine then it is 'global' in the sense that it is visible to a subroutine, as for example your $BASE_DIR variable. However it is not visible to another package. Declaring using
our creates a package variable, which is visible outside. Since you are using strict (that's good) then you will have to declare variables using my or our (or the older
use vars).
in which case, it is local?Ah. Be careful of your terminology. A third way is to declare a variable as
local, which probably does not do what you would think. It temporally overrides the value of a package variable, and is mostly used with system variables like $, $" $/ and so on.