in reply to More about module

Just my 2 eurocents:

1. I commonly use modules (so *.pm files) for anything that loads perl code (except sometimes configuration files created with Data::Dumper and the like)

2. Modules are probably a little slower (but i'd be surprised if it's significant).

3. If you load modules using the use MODULE statement, the file is loaded eval'ed at compile time, so syntax errors in the loaded files abort the script before running. Also, if you include an import routine in your module, it will be called whenever a use MODULE statement is found. (but the module itself will only be loaded and eval'ed once: when the first use is found.)

4. The main reason to declare functions and variables in different packages, is to make sure you don't override some other (global) vars or subroutines, and so you can create objects from them (object classes all need their own package name). In the end though, the *.pm extention is not really needed for all this, it just makes the whole process a little easier and less error-prone, because you can use *.pm files . (see 3.)

See also:

perldoc -f use perldoc -f require perldoc perlobj

Joost.