in reply to Running another script within CGI

OO is what you want.

Change the way you look at it, instead of thinking to put the longest sub in a separate file, you have to take a look at what you are doing, abstract classes out of them, and put properties and methods that are tight-coupled in classes.