Subroutine redefined warnings with require keyword

I've been writing a perl script that uses the require keyword. I need to use require for two files, say file a and file b. Here is a general overview of my code:

@files = ("a", "b");
 
foreach $file (@files){
require $file;
...
...
}
 

Whenever I run my script, I get subroutine "blah" redefined at file b warnings. There are subroutines defined in file a and file b that I need and some of them overlap each other. My script runs successfully however. Is there anyway that I can get rid of these warnings? I was thinking about destroying all of the subroutines loaded in by file a after the first iteration of the foreach loop as I don't need them for the second iteration. Is there a way to do this?

Thanks, appreciate any help!

  1. What're you trying to achieve?
  2. 'require' would look for $file in directories listed in @INC. Is $file available in one of the directories listed in @INC?
  3. Please post your input and desired output.