if ( @ARGV ) { print "I'm a script!\n"; # do stuff exit 0; } # only get to here if you we are a module