# File1.pm package File1; use File2; sub foo { File2::foo(@_); other(); code(); appended(); here(); } 1; # File2.pm package File2; sub foo { original(); code(); here(); } 1; # File 3 use File1; File1::foo(); # this will call File2::foo() behind the scenes