We need to see your subroutine, and how you are calling it. Also please give the versions of Perl on each machine (perl -v).
What do you mean by "sourcing the libraries"? "Sourcing" is a shell term, and by "libraries" do you mean "modules" or maybe "packages"? How are you trying to load these?
It's kinda a difficult to spot a bug when we can't see your code, Perl has so Many Ways Of Doing It.