package Module; BEGIN { print 'beginning my module'.join(', ',@ARGV)."\n" } # do lots of stuff BEGIN { print 'ending my module'.join(', ',@ARGV)."\n" } 1; #### #! /usr/bin/perl -w -T BEGIN: { print 'before using my module'.join(', ',@ARGV)."\n" } use lib qw(.); use Module; BEGIN { print 'after using my module'.join(', ',@ARGV)."\n" } #### # ./script.pl three two one before using my module three, two, one beginning my module three, two, one ending my module three, two, one after using my module one #### $ ./script.pl beginning my module ending my module after using my module before using my module