in reply to Understanding order of module compilation and execution

Why not experiment and see what happens? E.g.

A.pm

package A; BEGIN { print "compiling A\n" } print "executing A\n"; 1;

Z.pm (Not B since there is a B module already)

package Z; BEGIN { print "compiling Z\n" } print "executing Z\n"; 1;

script.pl

use strict; use warnings; BEGIN { print "compiling script.pl\n" } use A; use Z; print "executing script.pl\n";

result of running script.pl

compiling script.pl compiling A executing A compiling Z executing Z executing script.pl

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.