package MyModule; use strict; use Exporter; use vars qw($VERSION @ISA @EXPORT $MOD_CALL ); $VERSION = 1.00; @ISA = qw(Exporter); @EXPORT = qw( func1 ); sub func1 { return reverse @_ } sub import { $MOD_CALL++; } CHECK{ print $MOD_CALL ? "Called as a module\n" : "Called as a script\n" } 1;