in reply to Checking the command line arguments

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.

Replies are listed 'Best First'.
Re^2: Checking the command line arguments
by moritz (Cardinal) on Dec 03, 2009 at 13:34 UTC
    However it is not visible to another package.

    Be careful here. Lexical variables don't care about packages, lexicals and packages are completely orthogonal concepts.

    use strict; my $x = 42; { package OtherPackge; print $x, "\n"; }

    Lexical variables are visible within the current block, and each file is implicitly enclosed in a block.