in reply to using main package variables within a module

The problem you are having is with scope. Since you are making $one a local variable, it is only available withing the main package and the main code. So when another package accesses $main::one, it is actually getting the global version of the variable, which is undefined. At least this is how it was explained to me. If someone knows better, be sure to tell us!!!!

To get you code to work, you can do one of two thing.
1. Make $one a global. I don't like this idea, but it is there.
2. Use a typeglob so the variable is in scope. This is a much cleaner way to deal with the problem. To use a typeglob, you would change your code to look like this:

package Shop; use strict; use Exporter; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); $VERSION = 1.00; @ISA = qw(Exporter); @EXPORT = (); @EXPORT_OK = qw(db_connect); sub db_connect { *one = *main::one; print "Print - ",$one, " - from the Shop package\n"; } 1;
P.S. Why are you accessing vars in main anyway? You may want to reconsider your design to use an object and have your main script set parameters on that object. Or you should have the variable be in your package, and then export or typeglob it to main's name space.