in reply to the Magic Box system? (use require)

You wrote:
> what conditions must be in place in order to turn a > complete program into a 'magic box' or function that > can be included in another program?
You need to be more careful of scoping issues, particularly if you're using lexical variables. For exmaple, if you declared your hash as a file-scoped lexical (my) variable in your code, it wouldn't be available to the script that require-d it.

Another issue is that the script you're require-ing has to return a true value; that's why such scripts often end with

1;
You might also want to put the code that reads the config file into a subroutine that you can call. And you might want to read perlmod.