in reply to organizing program structure
i've been told i shouldn't use subroutines [...]. it seems there's a general hatred of gotos
Unless you are jumbling two topics, you are misusing the term "subroutine". A subroutine looks like the following in Perl:
sub foo { ... }
They enforce return to the correct point in the program. They provide encapsulation by limiting the scope of their private variables. They provide communication channels with the outside world (the parameter list and the return list) allowing looser coupling. The are re-entrant, allowing recursion. They are visible in a call stack, helping debugging. etc.
|
|---|