## put this code in Foo.pm package Foo; use strict; sub import { ## find out who is calling us my $pkg = caller; ## while strict doesn't deal with globs, it still ## catches symbolic de/referencing no strict 'refs'; ## iterate through all the globs in the symbol table foreach my $glob (keys %Foo::) { ## skip anything without a subroutine and 'import' next if not defined *{$Foo::{$glob}}{CODE} or $glob eq 'import'; ## assign subroutine into caller's package *{$pkg . "::$glob"} = \&{"Foo::$glob"}; } } ## this won't be imported ... $Foo::testsub = "a string"; ## ... but this will sub testsub { print "this is a testsub from Foo\n"; } ## and so will this sub fooify { return join " foo ", @_; } q;