http://www.perlmonks.org?node_id=1225627


in reply to Splitting program into modules

what am i missing here? How do properly split this code into logical chunks of separate files, but keeping namespace "main"?

There's nothing particularly "proper" about splitting the code into separate files. You keep things in main by writing subroutines, not by fragmenting the codebase and then struggling to unify it. One program should be one file, unless the "parts" are truly going to be reused by other programs (which they usually are not).