package Module; BEGIN { print 'beginning my module '.join(', ',@ARGV)."\n" } # do lots of stuff BEGIN { print 'ending my module '.join(', ',@ARGV)."\n" } sub import { print 'starting module import '.join(', ',@ARGV)."\n"; # stuff pop @ARGV; print 'ending module import '.join(', ',@ARGV)."\n"; } 1; #### $ ./script.pl a b c before using my module a, b, c beginning my module a, b, c ending my module a, b, c starting module import a, b, c ending module import a, b after using my module a, b