in reply to Set a variable in calling package

You're already using Exporter.

Exporter is capable of exporting variables as well as subs.

Is there a reason you aren't just exporting your $var, which would make it a member of both namespaces?

In prog.pl:

#!/usr/bin/env perl use strict; use warnings; use 5.010; use lib '.'; use MyModule; my_sub; say "Main program: $var";
In MyModule.pm:
package MyModule; use strict; use warnings; use 5.010; use base 'Exporter'; our $var; our @EXPORT = qw( my_sub $var ); sub my_sub { $var = 42; say "Set \$var to $var in my_sub"; }
Result:
$ ./prog.pl Set $var to 42 in my_sub Main program: 42