in reply to java/c has main - perl has ?

For a good example of this, look at the diagnostics module, which may also be called as the standalone program splain. (It 'splains what the error messages mean, get it?)

There's a bunch of stuff in there, but pay attention to how the variable $standalone is set and used. On top of which, the code's funny in several places....