use ModuleB qw( function ); BEGIN { *operate= \&function; undef \&function } use ModuleA qw( function );