in reply to undefined subroutine &main
Two pieces of (somewhat lengthy) reading-material will help your understanding very considerably:
It’s not rocket-science, but a few points are subtle, and these documents are excellent.