in reply to why main() call automatically?

I can't know why the main() function is called automatically? What's the mechanism?

It isn't called automatically. The line main(); calls the main function

How can I get result from formal document such as perldoc?

What do you mean by that, what result?

?? my $std_output = qx{perldoc perldoc };