in reply to Re^2: main package
in thread main package

So if I declare a variable without "my" , is that a package variable ?

There are three ways to declare a variable.

my $var; declares a lexical var.
our $var; declares a package var. The declaration is lexical.
use vars qw( $var ); declares a package var. The declaration is global.

If I declare a variable in the sub routine without "my" , is it still a package variable ?

It's irrelevant whether a sub is being compiled or not.

How to know which package statement is in effect ?

Look for a package statement in the source, or call __PACKAGE__.

If I want to use same variable name in another program, how can I do that ?

The question makes no sense. Please clarify