package P; use vars qw($f); sub foo { print "$f\n" } package main; $P::f = "howdy, world"; P::foo(); __END__ output: howdy, world #### package P; use strict; use vars qw($f); # NOTE: *f is a shared typeglob sub foo { print $f,"\n"; $f = "world"; } package main; use strict; use vars qw($f); # NOTE: *f shared with package P *P::f = *f; # make P::f an alias of main::f $f = "howdy"; P::foo(); # after this call, $f is changed! print $f,"\n"; __END__ ouput: howdy world