I'm trying to use something like the code below to check an argument to a perl program before loading any modules. This idea came from the Perl Cookbook. The problem is that when I run the code below, it can not find the help sub. It returns "Undefined subroutine &main::help". How do I make this code find the help subroutine?
Thanks in advance.
BEGIN {
if (@ARGV[0] != 1) {
&help;
}
}
help {
print "Show help message and exit\n";
exit;
}
use SomeModule;