#/usr/bin/perl use Foo; Foo::Prep(); for my $tree ("a","b") { local $ENV{PERL5LIB} = $tree; delete $INC{'Foo.pm'}; require Foo; Foo::Bar(); } Foo::Cleanup();