in reply to Running a module?

Whether you have been called as a script or included as a module can be checked by taking a look at caller.

A small example:

#!/usr/bin/perl package mymodule; use Data::Dumper; my @caller = caller; print Dumper ( @caller ); print "Execute this\n" unless caller; 1;
When called as perl mymodule.pm this outputs

Execute this
while when called as perl -Mmymodule -e '' it outputs

$VAR1 = 'main';
$VAR2 = '-e';
$VAR3 = 0;

Cheers

Antonio

The stupider the astronaut, the easier it is to win the trip to Vega - A. Tucket