in reply to Multiple uses

how many times will ModuleB be compiled?

Once ... unless you delete it's key/value pair from %INC, which Perl uses to determine if it's already loaded a particular module/file.

For details, see the "semantics similar to" code example in perldoc require, which I've excerpted the appropriate bits of (plus pointer comments) below for convenience.

sub require { my($filename) = @_; return 1 if $INC{$filename}; # <-- already loaded? # ... pull in the module $INC{$filename} = $realfilename; # <-- stop future reloads return $result; }

    --k.